diff --git a/changes/3605.misc.md b/changes/3605.misc.md new file mode 100644 index 0000000000..b8c0757b69 --- /dev/null +++ b/changes/3605.misc.md @@ -0,0 +1 @@ +Fix a bug in the test suite that prevented stand-alone example scripts from being tested. \ No newline at end of file diff --git a/tests/test_examples.py b/tests/test_examples.py index 54af4119e3..152b0a1a88 100644 --- a/tests/test_examples.py +++ b/tests/test_examples.py @@ -11,7 +11,7 @@ from packaging.requirements import Requirement examples_dir = "examples" -script_paths = Path(examples_dir).glob("*.py") +script_paths = tuple(Path(examples_dir).rglob("*.py")) PEP_723_REGEX: Final = r"(?m)^# /// (?P[a-zA-Z0-9-]+)$\s(?P(^#(| .*)$\s)+)^# ///$" @@ -62,6 +62,13 @@ def resave_script(source_path: Path, dest_path: Path) -> None: dest_path.write_text(dest_text) +def test_script_paths() -> None: + """ + Test that our test fixture is working properly and collecting script paths. + """ + assert len(script_paths) > 0 + + @pytest.mark.skipif( sys.platform in ("win32",), reason="This test fails due for unknown reasons on Windows in CI." )