mirror of
https://github.com/python/cpython.git
synced 2026-05-09 22:20:38 -04:00
[3.12] gh-68403: Fix test_coverage in test_trace (GH-108910) (#109104)
gh-68403: Fix test_coverage in test_trace (GH-108910)
Its behavior no longer affected by test running options such as -m.
(cherry picked from commit 7e1a7abb98)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
committed by
GitHub
parent
41ff5b0674
commit
68ba35eecb
@@ -360,9 +360,14 @@ class TestCoverage(unittest.TestCase):
|
||||
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)
|
||||
|
||||
Reference in New Issue
Block a user