Unverified Kaydet (Commit) b44a1d4f authored tarafından Serhiy Storchaka's avatar Serhiy Storchaka Kaydeden (comit) GitHub

bpo-34171: Fix test_trace. (GH-8940)

Remove "trace.cover" left from previous test runs before testing
that it is no longer created.
üst 393f1ff6
...@@ -385,13 +385,16 @@ class TestCoverageCommandLineOutput(unittest.TestCase): ...@@ -385,13 +385,16 @@ class TestCoverageCommandLineOutput(unittest.TestCase):
unlink(self.coverfile) unlink(self.coverfile)
def test_cover_files_written_no_highlight(self): 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] argv = '-m trace --count'.split() + [self.codefile]
status, stdout, stderr = assert_python_ok(*argv) status, stdout, stderr = assert_python_ok(*argv)
self.assertEqual(stderr, b'') 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.assertFalse(os.path.exists(tracecoverpath))
self.assertTrue(os.path.exists(self.coverfile)) self.assertTrue(os.path.exists(self.coverfile))
with open(self.coverfile) as f: with open(self.coverfile) as f:
self.assertEqual(f.read(), self.assertEqual(f.read(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment