mirror of
https://github.com/python/cpython.git
synced 2025-07-29 06:05:00 +00:00
#1648: add sys.gettrace() and sys.getprofile().
This commit is contained in:
parent
92058d2933
commit
56112895d6
5 changed files with 104 additions and 0 deletions
|
@ -4,6 +4,22 @@ import unittest
|
|||
|
||||
from test import test_support
|
||||
|
||||
class TestGetProfile(unittest.TestCase):
|
||||
def setUp(self):
|
||||
sys.setprofile(None)
|
||||
|
||||
def tearDown(self):
|
||||
sys.setprofile(None)
|
||||
|
||||
def test_empty(self):
|
||||
assert sys.getprofile() == None
|
||||
|
||||
def test_setget(self):
|
||||
def fn(*args):
|
||||
pass
|
||||
|
||||
sys.setprofile(fn)
|
||||
assert sys.getprofile() == fn
|
||||
|
||||
class HookWatcher:
|
||||
def __init__(self):
|
||||
|
@ -359,6 +375,7 @@ def show_events(callable):
|
|||
|
||||
def test_main():
|
||||
test_support.run_unittest(
|
||||
TestGetProfile,
|
||||
ProfileHookTestCase,
|
||||
ProfileSimulatorTestCase
|
||||
)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue