Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_hotshot.py

    r2 r391  
    1 import hotshot
    2 import hotshot.log
    31import os
    42import pprint
     
    108from test import test_support
    119
     10# Silence Py3k warning
     11hotshot = test_support.import_module('hotshot', deprecated=True)
    1212from hotshot.log import ENTER, EXIT, LINE
     13from hotshot import stats
    1314
    1415
     
    6566        if profiler is None:
    6667            profiler = self.new_profiler()
    67         self.failUnless(not profiler._prof.closed)
     68        self.assertTrue(not profiler._prof.closed)
    6869        profiler.runcall(callable)
    69         self.failUnless(not profiler._prof.closed)
     70        self.assertTrue(not profiler._prof.closed)
    7071        profiler.close()
    71         self.failUnless(profiler._prof.closed)
     72        self.assertTrue(profiler._prof.closed)
    7273        self.check_events(events)
    7374
     
    8182        info = log._info
    8283        list(log)
    83         self.failUnless(info["test-key"] == ["test-value"])
     84        self.assertTrue(info["test-key"] == ["test-value"])
    8485
    8586    def test_line_numbers(self):
     
    137138        gc.collect()
    138139
     140    def test_load_stats(self):
     141        def start(prof):
     142            prof.start()
     143        # Make sure stats can be loaded when start and stop of profiler
     144        # are not executed in the same stack frame.
     145        profiler = self.new_profiler()
     146        start(profiler)
     147        profiler.stop()
     148        profiler.close()
     149        stats.load(self.logfn)
     150        os.unlink(self.logfn)
     151
     152
    139153def test_main():
    140154    test_support.run_unittest(HotShotTestCase)
Note: See TracChangeset for help on using the changeset viewer.