From 252f61ce8dd9c0db21e957bd03eb9fd68f51867d Mon Sep 17 00:00:00 2001 From: Noam Bernstein Date: Fri, 21 Feb 2025 11:17:46 -0500 Subject: [PATCH] test for expyre job_name with special character --- tests/conftest.py | 11 ++++++----- tests/test_remote_run.py | 4 +++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 2393968a..8c1263bc 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -22,15 +22,16 @@ def do_init_mpipool(): wfl.autoparallelize.mpipool_support.init() -@pytest.mark.skipif( - "WFL_MPIPOOL" not in os.environ, reason="only init mpipool if WFL_MPIPOOL is in env" -) -@pytest.mark.mpi(minsize=2) +# marks on fixtures deprecated, let's hope that no one sets WFL_MPIPOOL +# when not using --with-mpi @pytest.mark.mpi(minsize=2) @pytest.fixture(scope="session", autouse=True) def init_mpipool(request): """initialize mpipool, only if running with mpirun """ - do_init_mpipool() + if "WFL_MPIPOOL" in os.environ: + do_init_mpipool() + else: + sys.stderr.write("Skipping init_mpipool since WFL_MPIPOOL env var not defined") # request.addfinalizer(finalizer_function) diff --git a/tests/test_remote_run.py b/tests/test_remote_run.py index 6a1e9318..6c68cadf 100644 --- a/tests/test_remote_run.py +++ b/tests/test_remote_run.py @@ -114,7 +114,9 @@ def do_vasp_fail(tmp_path, sys_name, monkeypatch, remoteinfo_env): def do_generic_calc(tmp_path, sys_name, monkeypatch, remoteinfo_env): - ri = {'sys_name': sys_name, 'job_name': 'pytest_'+sys_name, + # use a job_name with a regexp-special character to test + # bug in https://github.com/libAtoms/workflow/issues/353 + ri = {'sys_name': sys_name, 'job_name': 'pytest_' + sys_name + '+1', 'resources': {'max_time': '1h', 'num_nodes': 1}, 'num_inputs_per_queued_job': -36, 'check_interval': 10}