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

Set an environment variable with current test #2583

Closed
nicoddemus opened this Issue Jul 17, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@nicoddemus
Member

nicoddemus commented Jul 17, 2017

When executing tests in CI, sometimes a test may hang indefinitely. One can look at the output using -v but that might not always be reliable.

If pytest would set a specific environment variable with the test it is executing, one can use a process monitoring library like psutil to figure out which test is executing. This could be a variable named something like PYTEST_CURRENT_TEST which is set to the test node id. Alternatively, we could also add if the test is in the setup, call or teardown phase.

The implementation should be trivial and can be really helpful when diagnosing CI problems.

This was originally reported in pytest-xdist (pytest-dev/pytest-xdist#189), but @RonnyPfannschmidt correctly identified this should go into core pytest instead.

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