Set an environment variable with current test #2583
Labels
type: enhancement
new feature or API change, should be merged into features branch
type: feature-branch
new feature or API change, should be merged into features branch
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: