Skip to content

Commit b44a1d4

Browse files
bpo-34171: Fix test_trace. (GH-8940)
Remove "trace.cover" left from previous test runs before testing that it is no longer created.
1 parent 393f1ff commit b44a1d4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Lib/test/test_trace.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -385,13 +385,16 @@ def tearDown(self):
385385
unlink(self.coverfile)
386386

387387
def test_cover_files_written_no_highlight(self):
388+
# Test also that the cover file for the trace module is not created
389+
# (issue #34171).
390+
tracedir = os.path.dirname(os.path.abspath(trace.__file__))
391+
tracecoverpath = os.path.join(tracedir, 'trace.cover')
392+
unlink(tracecoverpath)
393+
388394
argv = '-m trace --count'.split() + [self.codefile]
389395
status, stdout, stderr = assert_python_ok(*argv)
390396
self.assertEqual(stderr, b'')
391-
tracedir = os.path.dirname(os.path.abspath(trace.__file__))
392-
tracecoverpath = os.path.join(tracedir, "trace.cover")
393397
self.assertFalse(os.path.exists(tracecoverpath))
394-
395398
self.assertTrue(os.path.exists(self.coverfile))
396399
with open(self.coverfile) as f:
397400
self.assertEqual(f.read(),

0 commit comments

Comments
 (0)