Skip to content

Handle pytest.exit from workers#1346

Open
gaoflow wants to merge 2 commits into
pytest-dev:masterfrom
gaoflow:fix-1239-handle-pytest-exit
Open

Handle pytest.exit from workers#1346
gaoflow wants to merge 2 commits into
pytest-dev:masterfrom
gaoflow:fix-1239-handle-pytest-exit

Conversation

@gaoflow

@gaoflow gaoflow commented Jun 25, 2026

Copy link
Copy Markdown

Summary

  • propagate pytest.exit() details from workers to the controller process
  • stop treating a worker that exits via pytest.exit() as a crashed worker with a pending crash item
  • re-raise pytest's Exit in the controller so the requested return code is preserved
  • add coverage for return codes 0 and 1

Closes #1239

Tests

  • uv run --python 3.11 --with '.[testing]' pytest testing/acceptance_test.py::TestNodeFailure::test_pytest_exit_is_not_reported_as_internal_error -q
  • uv run --python 3.11 --with '.[testing]' pytest testing -q
  • uv run --python 3.11 --with '.[testing]' --with ruff ruff check src/xdist/dsession.py src/xdist/remote.py testing/acceptance_test.py
  • uv run --python 3.11 --with '.[testing]' --with mypy --with setproctitle mypy src/xdist/dsession.py src/xdist/remote.py testing/acceptance_test.py
  • git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

pytest.exit causes internal error

1 participant