mirror of
https://github.com/python/cpython.git
synced 2025-09-27 18:59:43 +00:00
Add a test for the insertion of user-provided ADD_INFO records.
This commit is contained in:
parent
165b2cc2bd
commit
f3c54d6fc7
1 changed files with 12 additions and 2 deletions
|
@ -41,8 +41,7 @@ class HotShotTestCase(unittest.TestCase):
|
||||||
return hotshot.Profile(self.logfn, lineevents, linetimings)
|
return hotshot.Profile(self.logfn, lineevents, linetimings)
|
||||||
|
|
||||||
def get_logreader(self):
|
def get_logreader(self):
|
||||||
log = UnlinkingLogReader(self.logfn)
|
return UnlinkingLogReader(self.logfn)
|
||||||
return log
|
|
||||||
|
|
||||||
def get_events_wotime(self):
|
def get_events_wotime(self):
|
||||||
L = []
|
L = []
|
||||||
|
@ -68,6 +67,17 @@ class HotShotTestCase(unittest.TestCase):
|
||||||
profiler.close()
|
profiler.close()
|
||||||
self.check_events(events)
|
self.check_events(events)
|
||||||
|
|
||||||
|
def test_addinfo(self):
|
||||||
|
def f(p):
|
||||||
|
p.addinfo("test-key", "test-value")
|
||||||
|
profiler = self.new_profiler()
|
||||||
|
profiler.runcall(f, profiler)
|
||||||
|
profiler.close()
|
||||||
|
log = self.get_logreader()
|
||||||
|
info = log._info
|
||||||
|
list(log)
|
||||||
|
self.failUnless(info["test-key"] == ["test-value"])
|
||||||
|
|
||||||
def test_line_numbers(self):
|
def test_line_numbers(self):
|
||||||
def f():
|
def f():
|
||||||
y = 2
|
y = 2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue