예제 #1
0
    def test_log_timing_context(self):
        t = [1, 2]

        def time_f():
            return t.pop(0)
        set_time_func(time_f)
        with log_timing_context('my context'):
            pass
        self.assert_all_log_record(lambda r: 'my context' in r.msg)
        self.assert_any_log_record(lambda r: 'time taken: 1.0000 seconds' in r.msg)
예제 #2
0
    def test_log_timing_context(self):
        t = [1, 2]

        def time_f():
            return t.pop(0)

        set_time_func(time_f)
        with log_timing_context('my context'):
            pass
        self.assert_all_log_record(lambda r: 'my context' in r.msg)
        self.assert_any_log_record(
            lambda r: 'time taken: 1.0000 seconds' in r.msg)
예제 #3
0
    def test_log_timing(self):
        t = [1, 2]

        def time_f():
            return t.pop(0)

        @log_timing
        def foo():
            pass
        set_time_func(time_f)
        foo()
        self.assert_all_log_record(lambda r: 'foo' in r.msg)
        self.assert_any_log_record(lambda r: 'time taken: 1.0000 seconds' in r.msg)
예제 #4
0
    def test_log_timing(self):
        t = [1, 2]

        def time_f():
            return t.pop(0)

        @log_timing
        def foo():
            pass

        set_time_func(time_f)
        foo()
        self.assert_all_log_record(lambda r: 'foo' in r.msg)
        self.assert_any_log_record(
            lambda r: 'time taken: 1.0000 seconds' in r.msg)
예제 #5
0
 def tearDown(self):
     import time
     set_time_func(time.time)
     disable_slow_greenlet_log_warning()
예제 #6
0
 def tearDown(self):
     import time
     set_time_func(time.time)
     disable_slow_greenlet_log_warning()