#1648: add sys.gettrace() and sys.getprofile().

This commit is contained in:
Georg Brandl 2008-01-20 13:59:46 +00:00
parent 92058d2933
commit 56112895d6
5 changed files with 104 additions and 0 deletions

View file

@ -268,6 +268,20 @@ class TraceTestCase(unittest.TestCase):
self.compare_events(func.func_code.co_firstlineno,
tracer.events, func.events)
def set_and_retrieve_none(self):
sys.settrace(None)
assert sys.gettrace() is None
def set_and_retrieve_func(self):
def fn(*args):
pass
sys.settrace(fn)
try:
assert sys.gettrace() is fn
finally:
sys.settrace(None)
def test_01_basic(self):
self.run_test(basic)
def test_02_arigo(self):