Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More gracefully handle crashes in pytest. #682

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions colcon_core/task/python/test/pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@
# support pytest < 5.0
from _pytest.main import EXIT_TESTSFAILED
EXIT_CODE_TESTS_FAILED = EXIT_TESTSFAILED # noqa: N806
if completed.returncode == EXIT_CODE_TESTS_FAILED:
context.put_event_into_queue(
TestFailure(context.pkg.name))

try:
from _pytest.main import ExitCode
Expand All @@ -172,7 +169,15 @@
# support pytest < 5.0
from _pytest.main import EXIT_NOTESTSCOLLECTED
EXIT_CODE_NO_TESTS = EXIT_NOTESTSCOLLECTED # noqa: N806
if completed.returncode not in (
EXIT_CODE_NO_TESTS, EXIT_CODE_TESTS_FAILED

if sys.platform == 'win32':
EXIT_CODE_TESTS_CRASHED = 3221225477 # noqa: N806

Check warning on line 174 in colcon_core/task/python/test/pytest.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/task/python/test/pytest.py#L174

Added line #L174 was not covered by tests
else:
EXIT_CODE_TESTS_CRASHED = -11 # noqa: N806

Check warning on line 176 in colcon_core/task/python/test/pytest.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/task/python/test/pytest.py#L176

Added line #L176 was not covered by tests

if completed.returncode in (
EXIT_CODE_TESTS_FAILED, EXIT_CODE_TESTS_CRASHED
):
context.put_event_into_queue(TestFailure(context.pkg.name))

Check warning on line 181 in colcon_core/task/python/test/pytest.py

View check run for this annotation

Codecov / codecov/patch

colcon_core/task/python/test/pytest.py#L181

Added line #L181 was not covered by tests
elif completed.returncode != EXIT_CODE_NO_TESTS:
return completed.returncode
Loading