From 176185136bbeb3a2e724f18c5b20e07cf0569759 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Sun, 26 Aug 2018 18:18:52 +0300 Subject: [PATCH] bpo-34171: Fix test_trace. Remove "trace.cover" left from previous test runs before testing that it is no longer created. --- Lib/test/test_trace.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 3b335ca42f90eeb..63f474179d68c21 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -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(),