Set an environment variable with current test #2583
Closed
Comments
nicoddemus
added a commit
to nicoddemus/pytest
that referenced
this issue
Jul 18, 2017
nicoddemus
added a commit
to nicoddemus/pytest
that referenced
this issue
Jul 19, 2017
nicoddemus
added a commit
to nicoddemus/pytest
that referenced
this issue
Jul 19, 2017
nicoddemus
added a commit
to nicoddemus/pytest
that referenced
this issue
Jul 19, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 likePYTEST_CURRENT_TEST
which is set to the test node id. Alternatively, we could also add if the test is in thesetup
,call
orteardown
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.
The text was updated successfully, but these errors were encountered: