Skip to content

Commit 2dafb29

Browse files
authored
fixing notebook test errors when no tests collected (#4196)
Fix broken notebook tests in master. It seems that when `pattern` does not match any tests in `pytest -k pattern`, pytest returns an exit code 5. This breaks the newly sharded notebook tests, which are leveraging the `-k partition-n` pattern for changed notebooks. This fix adds the fix as per the recommendations of pytest-dev/pytest#2393.
1 parent 55873b9 commit 2dafb29

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

check/pytest

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,17 @@ fi
4141

4242
if [ -z "${ACTUALLY_QUIET}" ]; then
4343
pytest "${PYTEST_ARGS[@]}"
44+
RESULT=$?
4445
else
4546
# Filter out lines like "...F....x... [ 42%]", with coloring.
4647
pytest -q --color=yes "${PYTEST_ARGS[@]}" |
4748
perl -nle'print if not m{^(.\[0m)?[\.FEsx]+(.\[36m)?\s+\[\s*\d+%\](.\[0m)?$}'
48-
exit "${PIPESTATUS[0]}"
49+
RESULT=${PIPESTATUS[0]}
4950
fi
51+
52+
if [ "$RESULT" = 5 ]; then
53+
echo "[exit 5] No tests collected, but ignored."
54+
exit 0
55+
fi
56+
57+
exit "$RESULT"

0 commit comments

Comments
 (0)