Skip to content

Set an environment variable with current test #189

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

Closed
nicoddemus opened this issue Jul 17, 2017 · 3 comments
Closed

Set an environment variable with current test #189

nicoddemus opened this issue Jul 17, 2017 · 3 comments

Comments

@nicoddemus
Copy link
Member

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 each worker 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 worker is running which test. This could be a variable named something like PYTEST_XDIST_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.

@RonnyPfannschmidt what do you think?

@RonnyPfannschmidt
Copy link
Member

@nicoddemus this should go to core pytest, as its helpfull even for a non-xdist hang

@nicoddemus
Copy link
Member Author

Hmm good point. Will create an issue there.

@nicoddemus
Copy link
Member Author

Closed in favor of pytest-dev/pytest#2583

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

No branches or pull requests

2 participants