-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Pass test result to finalizer for cleaning up debug data #288
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
Labels
good first issue
easy issue that is friendly to new contributor
type: proposal
proposal for a new feature, often to gather opinions or design the API around the new feature
Comments
Original comment by holger krekel (BitBucket: hpk42, GitHub: hpk42): just quickly an example that works with today's pytest:
and the test file:
We could think about exposing something like "testresult" in standard pytest. |
pytestbot
pushed a commit
that referenced
this issue
Jun 15, 2015
…-punctuation-1430453576841 (pull request #288) monkeypatch.chdir docstring punctuation
I closed #230 as duplicate, maybe someone should make this as a plugin. |
jboy
pushed a commit
to jboy/nim-pymod
that referenced
this issue
Nov 28, 2015
…xtures. We use this to: * Clean up temporary files in the test directory, if the tests all passed. * Preserve temporary files in the test directory (renamed with a "failed_" prefix) for later inspection, if any tests failed. This required black magic, but Pytest really should make it easier for fixtures to access test results. This is a known (reported) issue: pytest-dev/pytest#288
closing this one as there is a supported way to do this |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
good first issue
easy issue that is friendly to new contributor
type: proposal
proposal for a new feature, often to gather opinions or design the API around the new feature
Originally reported by: Torsten Landschoff (BitBucket: bluehorn, GitHub: bluehorn)
We are currently juggling with big files in tests which we currently store in tmpdir.
This kills our Jenkins slaves because py.test will keep temporary files for 3 runs of each test suite. We are no up at > 10GB of temporary files for some projects per test run.
Keeping the temporary files is indeed a nice feature which we often use during TDD to find out what we were missing. But the temporary files of a passed test are 99.99% worthless for us.
Therefore I'd like to have a tmpdir fixture that cleans up the temporary files if the test was successful or skipped. Or have some options to configure how py.test handles temporary files wrt. what is kept.
As an intermediate step I am currently moving some pytest.fixture functions to clean up the temporary files after use, but I end up removing the files even if the test failed.
What I am also just realizing: We moved the temporary files inside the Jenkins workspace of each project to keep track of disk usage and for easy access via the web interface. If only temporary files for failed tests are kept, then we could archive them as build artifacts so that we can even diagnose tests that failed in the past.
I was thinking about something in the line of
Alternatively, pytest could use introspection to inject the testresult if the finalizer takes a testresult argument.
The text was updated successfully, but these errors were encountered: