From 53a6e53c21b7df6cd91b7b6f46df26ec5834ebc2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Wed, 19 Jul 2023 15:21:52 +0200 Subject: [PATCH] TST: run cookbook recipes in a deterministic order --- doc/source/cookbook/tests/test_cookbook.py | 27 ++++++---------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/doc/source/cookbook/tests/test_cookbook.py b/doc/source/cookbook/tests/test_cookbook.py index acc446d1dae..266569359ed 100644 --- a/doc/source/cookbook/tests/test_cookbook.py +++ b/doc/source/cookbook/tests/test_cookbook.py @@ -8,11 +8,11 @@ $ sed -e '/where/d' -i nose.cfg setup.cfg $ nosetests doc/source/cookbook/tests/test_cookbook.py -P -v """ -import glob -import os import subprocess import sys +from pathlib import Path + def run_with_capture(*args, **kwargs): sp = subprocess.Popen( @@ -33,32 +33,19 @@ def run_with_capture(*args, **kwargs): return sp.returncode -PARALLEL_TEST = {"rockstar_nest.py": "3"} BLACKLIST = [ - "opengl_ipython.py", - "opengl_vr.py", "matplotlib-animation.py", - "rockstar_nest.py", ] def test_recipe(): """Dummy test grabbing all cookbook's recipes""" - for fname in glob.glob("doc/source/cookbook/*.py"): - recipe = os.path.basename(fname) - if recipe in BLACKLIST: + COOKBOOK_DIR = Path("doc", "source", "cookbook") + for fname in sorted(COOKBOOK_DIR.glob("*.py")): + if fname.name in BLACKLIST: continue - check_recipe.description = f"Testing recipe: {recipe}" - if recipe in PARALLEL_TEST: - yield check_recipe, [ - "mpiexec", - "-n", - PARALLEL_TEST[recipe], - "python", - fname, - ] - else: - yield check_recipe, ["python", fname] + check_recipe.description = f"Testing recipe: {fname.name}" + yield check_recipe, ["python", str(fname)] def check_recipe(cmd):