Skip to content

Commit 8fc21c8

Browse files
bpo-26818: Add a test to make sure the bug is fixed (GH-8664)
The main cause of this bug was fixed as part of bpo-31908. (cherry picked from commit c8b0dbc) Co-authored-by: Berker Peksag <[email protected]>
1 parent c614121 commit 8fc21c8

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

Lib/test/test_trace.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,5 +438,27 @@ def test_sys_argv_list(self):
438438
status, trace_stdout, stderr = assert_python_ok('-m', 'trace', '-l', TESTFN)
439439
self.assertIn(direct_stdout.strip(), trace_stdout)
440440

441+
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+
441463
if __name__ == '__main__':
442464
unittest.main()

0 commit comments

Comments
 (0)