mirror of
https://github.com/python/cpython.git
synced 2025-12-04 16:43:27 +00:00
closes bpo-33445: fail properly in test_cprofile() (GH-6727)
This commit is contained in:
parent
43d12a6bd8
commit
ac9240b9be
1 changed files with 11 additions and 6 deletions
|
|
@ -51,13 +51,18 @@ class ProfileTest(unittest.TestCase):
|
||||||
results = self.do_profiling()
|
results = self.do_profiling()
|
||||||
expected = self.get_expected_output()
|
expected = self.get_expected_output()
|
||||||
self.assertEqual(results[0], 1000)
|
self.assertEqual(results[0], 1000)
|
||||||
|
fail = []
|
||||||
for i, method in enumerate(self.methodnames):
|
for i, method in enumerate(self.methodnames):
|
||||||
if results[i+1] != expected[method]:
|
a = expected[method]
|
||||||
print("Stats.%s output for %s doesn't fit expectation!" %
|
b = results[i+1]
|
||||||
(method, self.profilerclass.__name__))
|
if a != b:
|
||||||
print('\n'.join(unified_diff(
|
fail.append(f"\nStats.{method} output for "
|
||||||
results[i+1].split('\n'),
|
f"{self.profilerclass.__name__} "
|
||||||
expected[method].split('\n'))))
|
"does not fit expectation:")
|
||||||
|
fail.extend(unified_diff(a.split('\n'), b.split('\n'),
|
||||||
|
lineterm=""))
|
||||||
|
if fail:
|
||||||
|
self.fail("\n".join(fail))
|
||||||
|
|
||||||
def test_calling_conventions(self):
|
def test_calling_conventions(self):
|
||||||
# Issue #5330: profile and cProfile wouldn't report C functions called
|
# Issue #5330: profile and cProfile wouldn't report C functions called
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue