mirror of
https://github.com/python/cpython.git
synced 2025-11-25 04:34:37 +00:00
Some tests did not pass on repeated calls (regrtest -R::)
Perform additional cleanup, mostly deleting from sys.modules, or clearing the warnings registry.
This commit is contained in:
parent
6f34109384
commit
607bff1ebe
7 changed files with 29 additions and 9 deletions
|
|
@ -21,8 +21,9 @@ class ProfileTest(unittest.TestCase):
|
|||
def do_profiling(cls):
|
||||
results = []
|
||||
prof = cls.profilerclass(timer, 0.001)
|
||||
start_timer = timer()
|
||||
prof.runctx("testfunc()", globals(), locals())
|
||||
results.append(timer())
|
||||
results.append(timer() - start_timer)
|
||||
for methodname in cls.methodnames:
|
||||
s = StringIO()
|
||||
stats = pstats.Stats(prof, stream=s)
|
||||
|
|
@ -33,7 +34,7 @@ class ProfileTest(unittest.TestCase):
|
|||
|
||||
def test_cprofile(self):
|
||||
results = self.do_profiling()
|
||||
self.assertEqual(results[0], 43000)
|
||||
self.assertEqual(results[0], 1000)
|
||||
for i, method in enumerate(self.methodnames):
|
||||
self.assertEqual(results[i+1], self.expected_output[method],
|
||||
"Stats.%s output for %s doesn't fit expectation!" %
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue