diff options
author | Nicholas Bastin <nick.bastin@gmail.com> | 2004-03-22 20:12:56 (GMT) |
---|---|---|
committer | Nicholas Bastin <nick.bastin@gmail.com> | 2004-03-22 20:12:56 (GMT) |
commit | 1eb4bfc6579133c2d7a495141b1f754dfecf0fc6 (patch) | |
tree | ebdd1801beda401932abd45966cc052e461d74fc /Lib/test/test_profile.py | |
parent | 706933821c88508299a292e8bb20bf22a9f6364b (diff) | |
download | cpython-1eb4bfc6579133c2d7a495141b1f754dfecf0fc6.zip cpython-1eb4bfc6579133c2d7a495141b1f754dfecf0fc6.tar.gz cpython-1eb4bfc6579133c2d7a495141b1f754dfecf0fc6.tar.bz2 |
Added global runctx function to profile to fix SF Bug #716587
Diffstat (limited to 'Lib/test/test_profile.py')
-rw-r--r-- | Lib/test/test_profile.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Lib/test/test_profile.py b/Lib/test/test_profile.py index 6ff5811..1b1f50b 100644 --- a/Lib/test/test_profile.py +++ b/Lib/test/test_profile.py @@ -1,6 +1,8 @@ """Test suite for the profile module.""" import profile +import os +from test.test_support import TESTFN, vereq # In order to have reproducible time, we simulate a timer in the global # variable 'ticks', which represents simulated time in milliseconds. @@ -82,5 +84,17 @@ class C: ticks += 1 raise AttributeError + +def test_2(): + d = globals().copy() + def testfunc(): + global x + x = 1 + d['testfunc'] = testfunc + profile.runctx("testfunc()", d, d, TESTFN) + vereq (x, 1) + os.unlink (TESTFN) + if __name__ == "__main__": test_main() + test_2() |