pytest-dev / pytest-dev/pytest-xdist

Better integration with faulthandler

Open
#205 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement help wanted
Dominant language
Python
Stars
1.9k
Forks
287
Avg merge
9h 30m
Merged PRs (30d)
2

Description

One reason to use xdist is to run multithreaded tests in which case errors in the code under test tend to signal, terminating the slave. xdist allows to continue running tests in these circumstances.

It would be nice if it were possible to attach stack trace(s) (e.g. via faulthandler) or logs to such events from within the application code (immediately before signalling).

Currently the next best thing is to
(a) either have pytest-faulthandler set faulthandler up before any redirection happens, which will spew the stack traces as they happen (so they won't be reported in the test failure details). This doesn't allow to attach custom log text.
(b) run in a TTY and spew to /dev/tty which has the same problems as (a) plus it requires a TTY. This does allow for extra text.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how xdist handles a slave terminating during a multithreaded test and how pytest-faulthandler currently redirects output. Define how application-provided stack traces or logs should be captured and attached to the test failure details without requiring a TTY. Done means these diagnostics are preserved when the slave signals an error.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.