bpo-26818: Add a test to make sure the bug is fixed (GH-8664) · python/cpython@c8b0dbc
@@ -438,5 +438,27 @@ def test_sys_argv_list(self):
438438status, trace_stdout, stderr = assert_python_ok('-m', 'trace', '-l', TESTFN)
439439self.assertIn(direct_stdout.strip(), trace_stdout)
440440441+def test_count_and_summary(self):
442+filename = f'{TESTFN}.py'
443+coverfilename = f'{TESTFN}.cover'
444+with open(filename, 'w') as fd:
445+self.addCleanup(unlink, filename)
446+self.addCleanup(unlink, coverfilename)
447+fd.write(textwrap.dedent("""\
448+ x = 1
449+ y = 2
450+451+ def f():
452+ return x + y
453+454+ for i in range(10):
455+ f()
456+ """))
457+status, stdout, _ = assert_python_ok('-m', 'trace', '-cs', filename)
458+stdout = stdout.decode()
459+self.assertEqual(status, 0)
460+self.assertIn('lines cov% module (path)', stdout)
461+self.assertIn(f'6 100% {TESTFN} ({filename})', stdout)
462+441463if __name__ == '__main__':
442464unittest.main()