]> granicus.if.org Git - python/commitdiff
Add a test for the insertion of user-provided ADD_INFO records.
authorFred Drake <fdrake@acm.org>
Mon, 29 Oct 2001 20:54:01 +0000 (20:54 +0000)
committerFred Drake <fdrake@acm.org>
Mon, 29 Oct 2001 20:54:01 +0000 (20:54 +0000)
Lib/test/test_hotshot.py

index 7188f1b9b752f8adee6f4b5bb639524b3abe3417..938687ef78d5845bf04c9bddf8d5879bf482bbcb 100644 (file)
@@ -41,8 +41,7 @@ class HotShotTestCase(unittest.TestCase):
         return hotshot.Profile(self.logfn, lineevents, linetimings)
 
     def get_logreader(self):
-        log = UnlinkingLogReader(self.logfn)
-        return log
+        return UnlinkingLogReader(self.logfn)
 
     def get_events_wotime(self):
         L = []
@@ -68,6 +67,17 @@ class HotShotTestCase(unittest.TestCase):
         profiler.close()
         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 f():
             y = 2