Skip to content

Commit

Permalink
bpo-34171: Fix test_trace. (GH-8940) (GH-8951)
Browse files Browse the repository at this point in the history
Remove "trace.cover" left from previous test runs before testing
that it is no longer created.
(cherry picked from commit b44a1d4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
  • Loading branch information
miss-islington and serhiy-storchaka committed Aug 28, 2018
1 parent 2cf3316 commit e3f2082
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Lib/test/test_trace.py
Expand Up @@ -385,13 +385,16 @@ def tearDown(self):
unlink(self.coverfile)

def test_cover_files_written_no_highlight(self):
# Test also that the cover file for the trace module is not created
# (issue #34171).
tracedir = os.path.dirname(os.path.abspath(trace.__file__))
tracecoverpath = os.path.join(tracedir, 'trace.cover')
unlink(tracecoverpath)

argv = '-m trace --count'.split() + [self.codefile]
status, stdout, stderr = assert_python_ok(*argv)
self.assertEqual(stderr, b'')
tracedir = os.path.dirname(os.path.abspath(trace.__file__))
tracecoverpath = os.path.join(tracedir, "trace.cover")
self.assertFalse(os.path.exists(tracecoverpath))

self.assertTrue(os.path.exists(self.coverfile))
with open(self.coverfile) as f:
self.assertEqual(f.read(),
Expand Down

0 comments on commit e3f2082

Please sign in to comment.