diff --git a/.github/workflows/ex-workflow.yml b/.github/workflows/ex-workflow.yml index e5338cf4..fb4dcbe4 100644 --- a/.github/workflows/ex-workflow.yml +++ b/.github/workflows/ex-workflow.yml @@ -95,7 +95,7 @@ jobs: - name: Create example models working-directory: modflow6-examples/autotest # run the scripts via pytest without running the models, just build input files - run: pixi run pytest -v -n=auto --durations=0 test_scripts.py --init + run: pixi run pytest -v -n=auto --dist=worksteal --durations=0 test_scripts.py --init - name: Make zipfile working-directory: modflow6-examples @@ -184,7 +184,7 @@ jobs: - name: Run examples, make plots working-directory: modflow6-examples/autotest - run: pixi run pytest -v -n=auto --durations=0 test_scripts.py --plot + run: pixi run pytest -v -n=auto --dist=worksteal --durations=0 test_scripts.py --plot - name: Run postprocessing working-directory: modflow6-examples/scripts diff --git a/autotest/conftest.py b/autotest/conftest.py index 476edf08..039d08d1 100644 --- a/autotest/conftest.py +++ b/autotest/conftest.py @@ -8,6 +8,8 @@ pytest_plugins = ["modflow_devtools.fixtures", "modflow_devtools.snapshots"] EXCLUDE = [] +# slowest first, so they don't straggle at the end of parallel runs +SLOW = ["ex-gwf-sagehen", "ex-gwt-rotate", "ex-gwt-uzt-2d", "ex-gwt-hecht-mendez"] PROJ_ROOT = Path(__file__).parents[1] SCRIPTS_PATH = PROJ_ROOT / "scripts" TABLES_PATH = PROJ_ROOT / "tables" @@ -157,3 +159,13 @@ def pytest_generate_tests(metafunc): if file.stem not in EXCLUDE } metafunc.parametrize("example_script", scripts.values(), ids=scripts.keys()) + + +def pytest_collection_modifyitems(items): + def rank(item): + for i, name in enumerate(SLOW): + if f"[{name}.py]" in item.nodeid: + return i + return len(SLOW) + + items.sort(key=rank)