Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python: support Python 3.12 #5691

Merged
merged 3 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ STDERR_DEVNULL = $(stderr_devnull_$(V))
stderr_devnull_ = $(stderr_devnull_$(AM_DEFAULT_VERBOSITY))
stderr_devnull_0 = >/dev/null 2>&1

$(MAN_FILES): conf.py $(RST_FILES)
$(MAN_FILES): manpages.py conf.py $(RST_FILES)
$(sphinx_man) \
PYTHONPATH=$(PYTHONPATH):$(abs_srcdir) \
SPHINX_BUILDDIR=$(abs_builddir) $(PYTHON) \
Expand Down
4 changes: 2 additions & 2 deletions doc/manpages.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,8 +267,8 @@
('man3/flux_shell_log', 'flux_shell_log', 'Log shell plugin messages to registered shell loggers', [author], 3),
('man3/flux_shell_plugstack_call', 'flux_shell_plugstack_call', 'Calls the function referenced by topic.', [author], 3),
('man3/flux_shell_rpc_pack', 'flux_shell_rpc_pack', 'perform an rpc to a running flux shell using Jansson style pack arguments', [author], 3),
('man3/flux_shell_service_register', 'flux_shell_service_register', 'Register a service handler for \`method\` in the shell.', [author], 3),
('man3/flux_shell_task_channel_subscribe', 'flux_shell_task_channel_subscribe', 'Call \`cb\` when \`name\` is ready for reading.', [author], 3),
('man3/flux_shell_service_register', 'flux_shell_service_register', r'Register a service handler for \`method\` in the shell.', [author], 3),
('man3/flux_shell_task_channel_subscribe', 'flux_shell_task_channel_subscribe', r'Call \`cb\` when \`name\` is ready for reading.', [author], 3),
('man3/flux_shell_task_get_info', 'flux_shell_task_info_unpack', 'interfaces for fetching task info', [author], 3),
('man3/flux_shell_task_get_info', 'flux_shell_task_get_info', 'interfaces for fetching task info', [author], 3),
('man3/flux_shell_task_subprocess', 'flux_shell_task_cmd', 'return the subprocess and cmd structure of a shell task, respectively', [author], 3),
Expand Down
4 changes: 2 additions & 2 deletions src/bindings/python/_flux/make_clean_header.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ def process_header(f, including_path="."):
return
with open(f, "r") as header:
for l in header.readlines():
m = re.search('#include\s*"([^"]*)"', l)
m = re.search(r'#include\s*"([^"]*)"', l)
if m:
nf = find_first(args.search, m.group(1), including_path)
process_header(nf, os.path.dirname(os.path.abspath(nf)))
if not re.match("#\s*include", l):
if not re.match(r"#\s*include", l):
mega_header += l
checked_heads[f] = 1

Expand Down
18 changes: 14 additions & 4 deletions t/python/t0012-futures.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,28 @@ def setUpClass(self):
self.f = flux.Flux()
self.ping_payload = {"seq": 1, "pad": "stuff"}

@staticmethod
def is_subset(x, y):
"""Return true if all keys in x are present and equal to keys in y"""
for key, val in x.items():
if key not in y:
raise ValueError(f"key {key} missing in {y}")
if y[key] != val:
raise ValueError(f"key {key} is not {val} (got {x[key]})")
return True

def test_01_rpc_get(self):
future = self.f.rpc("broker.ping", self.ping_payload)
resp_payload = future.get()
self.assertDictContainsSubset(self.ping_payload, resp_payload)
self.assertTrue(self.is_subset(self.ping_payload, resp_payload))

def test_02_get_flux(self):
future = self.f.rpc("broker.ping", self.ping_payload)
future.get_flux()
# force a full garbage collection pass to test that the handle is not destructed
gc.collect(2)
resp_payload = future.get()
self.assertDictContainsSubset(self.ping_payload, resp_payload)
self.assertTrue(self.is_subset(self.ping_payload, resp_payload))

def test_02_future_wait_for(self):
future = self.f.rpc("broker.ping", self.ping_payload)
Expand All @@ -55,7 +65,7 @@ def test_02_future_wait_for(self):
self.fail(msg="future fulfillment timed out")
else:
raise
self.assertDictContainsSubset(self.ping_payload, resp_payload)
self.assertTrue(self.is_subset(self.ping_payload, resp_payload))

def test_03_future_then(self):
"""Register a 'then' cb and run the reactor to ensure it runs"""
Expand All @@ -67,7 +77,7 @@ def then_cb(future, arg):
try:
resp_payload = future.get()
cb_ran[0] = True
self.assertDictContainsSubset(arg, resp_payload)
self.assertTrue(self.is_subset(arg, resp_payload))
finally:
# ensure that reactor is always stopped, avoiding a hung test
flux_handle.reactor_stop(reactor)
Expand Down