Skip to content
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
Closed

Set an environment variable with current test #2583

nicoddemus opened this issue Jul 17, 2017 · 0 comments
Assignees
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

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 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.

@nicoddemus nicoddemus added 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 labels Jul 17, 2017
@nicoddemus nicoddemus self-assigned this Jul 17, 2017
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
@nicoddemus nicoddemus added type: enhancement new feature or API change, should be merged into features branch and removed type: enhancement new feature or API change, should be merged into features branch labels Sep 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant