Skip to content

Commit a8fdafd

Browse files
committed
added '--only-slurm' option to conftest to avoid duplicating tests in slurm-only ci jobs
1 parent 4176284 commit a8fdafd

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

.github/workflows/ci-cd.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ jobs:
174174
docker exec slurm bash -c "pip install --upgrade pip && pip install -e /pydra[test,psij] && python -c 'import pydra.engine; print(pydra.engine.__version__)'"
175175
- name: Run pytest
176176
run: |
177-
docker exec slurm bash -c "pytest /pydra/pydra/engine/tests/test_submitter.py --with-psij --color=yes -vs --cov pydra --cov-config /pydra/.coveragerc --cov-report xml:/pydra/cov.xml --doctest-modules /pydra/pydra/"
177+
docker exec slurm bash -c "pytest /pydra/pydra/engine/tests/test_submitter.py --with-psij --only-slurm --color=yes -vs --cov pydra --cov-config /pydra/.coveragerc --cov-report xml:/pydra/cov.xml"
178178
- name: Upload to codecov
179179
run: |
180180
docker exec slurm bash -c "pip install urllib3==1.26.6"

pydra/conftest.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@ def pytest_addoption(parser):
1212
action="store_true",
1313
help="run with psij workers in test matrix",
1414
)
15+
parser.addoption(
16+
"--only-slurm",
17+
action="store_true",
18+
help="only run tests with slurm workers",
19+
)
1520

1621

1722
def pytest_generate_tests(metafunc):
1823
if "worker" in metafunc.fixturenames:
1924
metafunc.parametrize("worker", ["debug", "cf"])
2025

2126
if "any_worker" in metafunc.fixturenames:
22-
available_workers = ["debug", "cf"]
27+
2328
try:
2429
use_dask = metafunc.config.getoption("dask")
2530
except ValueError:
@@ -28,13 +33,18 @@ def pytest_generate_tests(metafunc):
2833
use_psij = metafunc.config.getoption("with-psij")
2934
except ValueError:
3035
use_psij = False
36+
try:
37+
only_slurm = metafunc.config.getoption("only-slurm")
38+
except ValueError:
39+
only_slurm = False
40+
available_workers = ["debug", "cf"] if not only_slurm else []
3141
if use_dask:
3242
available_workers.append("dask")
3343
if bool(shutil.which("sbatch")):
3444
available_workers.append("slurm")
3545
if use_psij:
3646
available_workers.append("psij-slurm")
37-
if use_psij:
47+
if use_psij and not only_slurm:
3848
available_workers.append("psij-local")
3949
metafunc.parametrize("any_worker", available_workers)
4050

0 commit comments

Comments
 (0)