Skip to content

Commit fb82248

Browse files
committed
Expand error message on notebook without test
1 parent bcee5f3 commit fb82248

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tests/test_all_notebooks_are_tested.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,12 @@
77
def test_is_notebook_tested(notebook_name: str):
88
if not _should_skip_notebook(notebook_name):
99
expected_test_name = f"test_{notebook_name[:-6]}.py" # [:-6] removes ".ipynb"
10-
assert list(
11-
ROOT_DIRECTORY.rglob(expected_test_name)
12-
), f"No test was found for '{notebook_name}'. Expecting to find '{expected_test_name}'"
10+
assert list(ROOT_DIRECTORY.rglob(expected_test_name)), (
11+
f"No test was found for '{notebook_name}'. Expecting to find '{expected_test_name}'"
12+
f"\nIt is common for notebooks tests to be placed in 'ROOT_FOLDER/tests/notebooks/{expected_test_name}'."
13+
"\nNote: tests are auto-generated when using pre-commit."
14+
"\nIf you prefer to generate them without pre-commit, please execute 'ROOT_FOLDER/.internal/pre_commit_tools/auto_add_tests.py <full_path_to_your_new_notebook_ipynb_file>'"
15+
)
1316

1417

1518
def _should_skip_notebook(notebook_name: str) -> bool:

0 commit comments

Comments
 (0)