From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Tue, 28 Aug 2018 08:41:43 +0000 (-0400) Subject: bpo-34171: Fix test_trace. (GH-8940) (GH-8951) X-Git-Tag: v3.7.1rc1~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3f20828f6b7f59baa2d25437176ee32ae7700b0;p=thirdparty%2FPython%2Fcpython.git bpo-34171: Fix test_trace. (GH-8940) (GH-8951) Remove "trace.cover" left from previous test runs before testing that it is no longer created. (cherry picked from commit b44a1d4f71daf4edb948b9878f82a60891e4a2e1) Co-authored-by: Serhiy Storchaka --- diff --git a/Lib/test/test_trace.py b/Lib/test/test_trace.py index 3b335ca42f90..63f474179d68 100644 --- a/Lib/test/test_trace.py +++ b/Lib/test/test_trace.py @@ -385,13 +385,16 @@ class TestCoverageCommandLineOutput(unittest.TestCase): 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(),