gh-68403: Fix test_coverage in test_trace (GH-108910)

Its behavior no longer affected by test running options such as -m.
This commit is contained in:
Serhiy Storchaka 2023-09-07 21:28:18 +03:00 committed by GitHub
parent 1829a3c9a3
commit 7e1a7abb98
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -360,9 +360,14 @@ def tearDown(self):
rmtree(TESTFN)
unlink(TESTFN)
def _coverage(self, tracer,
cmd='import test.support, test.test_pprint;'
'test.support.run_unittest(test.test_pprint.QueryTestCase)'):
DEFAULT_SCRIPT = '''if True:
import unittest
from test.test_pprint import QueryTestCase
loader = unittest.TestLoader()
tests = loader.loadTestsFromTestCase(QueryTestCase)
tests(unittest.TestResult())
'''
def _coverage(self, tracer, cmd=DEFAULT_SCRIPT):
tracer.run(cmd)
r = tracer.results()
r.write_results(show_missing=True, summary=True, coverdir=TESTFN)