File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22import os
33from utils_for_tests import get_all_notebooks , ROOT_DIRECTORY , resolve_notebook_path
44
5+ TESTS_FOLDER = ROOT_DIRECTORY / "tests"
6+
7+
8+ @pytest .fixture
9+ def all_test_file_names () -> list [str ]:
10+ return [i .name for i in TESTS_FOLDER .rglob ("test_*.py" )]
11+
512
613@pytest .mark .parametrize ("notebook_name" , map (os .path .basename , get_all_notebooks ()))
7- def test_is_notebook_tested (notebook_name : str ):
14+ def test_is_notebook_tested (notebook_name : str , all_test_file_names : list [ str ] ):
815 if not _should_skip_notebook (notebook_name ):
916 expected_test_name = f"test_{ notebook_name [:- 6 ]} .py" # [:-6] removes ".ipynb"
10- assert list ( ROOT_DIRECTORY . rglob ( expected_test_name )) , (
17+ assert expected_test_name in all_test_file_names , (
1118 f"No test was found for '{ notebook_name } '. Expecting to find '{ expected_test_name } '"
1219 f"\n It is common for notebooks tests to be placed in 'ROOT_FOLDER/tests/notebooks/{ expected_test_name } '."
1320 "\n Note: tests are auto-generated when using pre-commit."
You can’t perform that action at this time.
0 commit comments