Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 4e299c7

Browse files
committed
unbreak test_cprofile
1 parent d8506df commit 4e299c7

3 files changed

Lines changed: 72 additions & 130 deletions

File tree

Lib/test/regrtest.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1137,7 +1137,6 @@ def __init__(self):
11371137

11381138
# These are broken tests, for now skipped on every platform.
11391139
# XXX Fix these!
1140-
self.expected.add('test_cProfile')
11411140
self.expected.add('test_nis')
11421141

11431142
# expected to be skipped on every platform, even Linux

Lib/test/test_cProfile.py

Lines changed: 0 additions & 129 deletions
This file was deleted.

Lib/test/test_cprofile.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
"""Test suite for the cProfile module."""
2+
3+
import sys
4+
from test.support import run_unittest
5+
6+
# rip off all interesting stuff from test_profile
7+
import cProfile
8+
from test.test_profile import ProfileTest, regenerate_expected_output
9+
10+
class CProfileTest(ProfileTest):
11+
profilerclass = cProfile.Profile
12+
13+
14+
def test_main():
15+
run_unittest(CProfileTest)
16+
17+
def main():
18+
if '-r' not in sys.argv:
19+
test_main()
20+
else:
21+
regenerate_expected_output(__file__, CProfileTest)
22+
23+
24+
# Don't remove this comment. Everything below it is auto-generated.
25+
#--cut--------------------------------------------------------------------------
26+
CProfileTest.expected_output['print_stats'] = """\
27+
28 0.028 0.001 0.028 0.001 profilee.py:110(__getattr__)
28+
1 0.270 0.270 1.000 1.000 profilee.py:25(testfunc)
29+
23/3 0.150 0.007 0.170 0.057 profilee.py:35(factorial)
30+
20 0.020 0.001 0.020 0.001 profilee.py:48(mul)
31+
2 0.040 0.020 0.600 0.300 profilee.py:55(helper)
32+
4 0.116 0.029 0.120 0.030 profilee.py:73(helper1)
33+
2 0.000 0.000 0.140 0.070 profilee.py:84(helper2_indirect)
34+
8 0.312 0.039 0.400 0.050 profilee.py:88(helper2)
35+
8 0.064 0.008 0.080 0.010 profilee.py:98(subhelper)"""
36+
CProfileTest.expected_output['print_callers'] = """\
37+
profilee.py:110(__getattr__) <- 16 0.016 0.016 profilee.py:98(subhelper)
38+
profilee.py:25(testfunc) <- 1 0.270 1.000 <string>:1(<module>)
39+
profilee.py:35(factorial) <- 1 0.014 0.130 profilee.py:25(testfunc)
40+
20/3 0.130 0.147 profilee.py:35(factorial)
41+
2 0.006 0.040 profilee.py:84(helper2_indirect)
42+
profilee.py:48(mul) <- 20 0.020 0.020 profilee.py:35(factorial)
43+
profilee.py:55(helper) <- 2 0.040 0.600 profilee.py:25(testfunc)
44+
profilee.py:73(helper1) <- 4 0.116 0.120 profilee.py:55(helper)
45+
profilee.py:84(helper2_indirect) <- 2 0.000 0.140 profilee.py:55(helper)
46+
profilee.py:88(helper2) <- 6 0.234 0.300 profilee.py:55(helper)
47+
2 0.078 0.100 profilee.py:84(helper2_indirect)
48+
profilee.py:98(subhelper) <- 8 0.064 0.080 profilee.py:88(helper2)
49+
{built-in method exc_info} <- 4 0.000 0.000 profilee.py:73(helper1)
50+
{built-in method hasattr} <- 4 0.000 0.004 profilee.py:73(helper1)
51+
8 0.000 0.008 profilee.py:88(helper2)
52+
{method 'append' of 'list' objects} <- 4 0.000 0.000 profilee.py:73(helper1)"""
53+
CProfileTest.expected_output['print_callees'] = """\
54+
<string>:1(<module>) -> 1 0.270 1.000 profilee.py:25(testfunc)
55+
profilee.py:110(__getattr__) ->
56+
profilee.py:25(testfunc) -> 1 0.014 0.130 profilee.py:35(factorial)
57+
2 0.040 0.600 profilee.py:55(helper)
58+
profilee.py:35(factorial) -> 20/3 0.130 0.147 profilee.py:35(factorial)
59+
20 0.020 0.020 profilee.py:48(mul)
60+
profilee.py:48(mul) ->
61+
profilee.py:55(helper) -> 4 0.116 0.120 profilee.py:73(helper1)
62+
2 0.000 0.140 profilee.py:84(helper2_indirect)
63+
6 0.234 0.300 profilee.py:88(helper2)
64+
profilee.py:73(helper1) -> 4 0.000 0.000 {built-in method exc_info}
65+
profilee.py:84(helper2_indirect) -> 2 0.006 0.040 profilee.py:35(factorial)
66+
2 0.078 0.100 profilee.py:88(helper2)
67+
profilee.py:88(helper2) -> 8 0.064 0.080 profilee.py:98(subhelper)
68+
profilee.py:98(subhelper) -> 16 0.016 0.016 profilee.py:110(__getattr__)
69+
{built-in method hasattr} -> 12 0.012 0.012 profilee.py:110(__getattr__)"""
70+
71+
if __name__ == "__main__":
72+
main()

0 commit comments

Comments
 (0)