diff options
author | Ned Batchelder <ned@nedbatchelder.com> | 2018-10-14 20:39:46 -0400 |
---|---|---|
committer | Ned Batchelder <ned@nedbatchelder.com> | 2018-10-14 20:59:57 -0400 |
commit | ae9f040dc4189d73fdd708aa4ba61bf50d7b2a25 (patch) | |
tree | ee36612ab56483fbbcae6fc60c4f2812ef9014a5 /tests/test_debug.py | |
parent | 4a404ce724280bf9c5f4bcf1e6a5ba76d7499d89 (diff) | |
download | python-coveragepy-git-ae9f040dc4189d73fdd708aa4ba61bf50d7b2a25.tar.gz |
Defer using the database when calling set_context #716
The collector calls set_context() before any code is run. If we touch
the database there, it will get created *very* early. This causes
problems with pytest-cov, which will delete those early-created files
when erasing data.
By deferring the database access until add_lines is called, the data
file stays off the disk until the collection is done (or until the
context switches), which avoids the problem.
Diffstat (limited to 'tests/test_debug.py')
-rw-r--r-- | tests/test_debug.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tests/test_debug.py b/tests/test_debug.py index 63edc84f..284d9567 100644 --- a/tests/test_debug.py +++ b/tests/test_debug.py @@ -144,8 +144,8 @@ class DebugTraceTest(CoverageTest): self.assertRegex(real_messages[-1], r"^\s*\d+\.\w{4}: Writing data") self.assertRegex(last_line, r"\s+_write_file : .*coverage[/\\]data.py @\d+$") else: - self.assertRegex(real_messages[-1], r"^\s*\d+\.\w{4}: Adding lines") - self.assertRegex(last_line, r"\s+add_lines : .*coverage[/\\]sqldata.py @\d+$") + self.assertRegex(real_messages[-1], r"^\s*\d+\.\w{4}: Creating data file") + self.assertRegex(last_line, r"\s+_create_db : .*coverage[/\\]sqldata.py @\d+$") def test_debug_config(self): out_lines = self.f1_debug_output(["config"]) |