diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-21 06:56:40 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-08-24 06:54:17 -0400 |
commit | 074d8843c0d7909bbc6692f20cc056725d26041c (patch) | |
tree | 193b3974b306c41c40c44aea414744f184ab1a36 | |
parent | e248080707eb0d350f2f4bb08b555f4f3670b601 (diff) | |
download | python-coveragepy-git-074d8843c0d7909bbc6692f20cc056725d26041c.tar.gz |
Enable keeping test-created temp dirs
-rw-r--r-- | doc/contributing.rst | 11 | ||||
-rw-r--r-- | tests/coveragetest.py | 6 | ||||
-rw-r--r-- | tox.ini | 2 |
3 files changed, 15 insertions, 4 deletions
diff --git a/doc/contributing.rst b/doc/contributing.rst index 71fa6937..24a2636d 100644 --- a/doc/contributing.rst +++ b/doc/contributing.rst @@ -122,13 +122,14 @@ To limit tox to just a few versions of Python, use the ``-e`` switch:: To run just a few tests, you can use `pytest test selectors`_:: $ tox tests/test_misc.py - $ tox tests/test_misc.py::SetupPyTest - $ tox tests/test_misc.py::SetupPyTest::test_metadata + $ tox tests/test_misc.py::HasherTest + $ tox tests/test_misc.py::HasherTest::test_string_hashing These command run the tests in one file, one class, and just one test, respectively. -You can also affect the test runs with environment variables: +You can also affect the test runs with environment variables. Define any of +these as 1 to use them: - COVERAGE_NO_PYTRACER disables the Python tracer if you only want to run the CTracer tests. @@ -142,6 +143,10 @@ You can also affect the test runs with environment variables: - COVERAGE_KEEP_OUTPUT will save the output files that were generated by the gold-file tests, ones that compare output files to saved gold files. +- COVERAGE_KEEP_TMP keeps the temporary directories in which tests are run. + This makes debugging tests easier. The temporary directories are at + ``$TMPDIR/coverage_test/*``, and are named for the test that made them. + Of course, run all the tests on every version of Python you have, before submitting a change. diff --git a/tests/coveragetest.py b/tests/coveragetest.py index b804a782..6e308718 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -81,6 +81,12 @@ class CoverageTest( # Let stderr go to stderr, pytest will capture it for us. show_stderr = True + # Temp dirs go to $TMPDIR/coverage_test/* + temp_dir_prefix = "coverage_test/" + + # Keep the temp directories if the env says to. + keep_temp_dir = bool(int(os.getenv("COVERAGE_KEEP_TMP", 0))) + def setUp(self): super(CoverageTest, self).setUp() @@ -17,7 +17,7 @@ deps = setuptools==40.0.0 mock==2.0.0 PyContracts==1.8.3 - unittest-mixins==1.4 + unittest-mixins==1.5 #-e/Users/ned/unittest_mixins # gevent 1.3 causes a failure: https://bitbucket.org/ned/coveragepy/issues/663/gevent-132-on-windows-fails py{27,34,35,36}: gevent==1.2.2 |