Example #1
0
    def test_watch_match(self):
        self.tracer.watch("no_mod")
        with self.tm:
            testmod.f()
        self.assertEqual(0, self.mock.call_count)

        self.tracer.unwatch("no_mod")
        self.tracer.watch("testmod.f")
        with self.tm:
            testmod.f()
        self.assertNotEqual(0, self.mock.call_count)
Example #2
0
    def test_watch_match(self):
        self.tracer.watch("no_mod")
        with self.tm:
            testmod.f()
        self.assertEqual(0, self.mock.call_count)

        self.tracer.unwatch("no_mod")
        self.tracer.watch("testmod.f")
        with self.tm:
            testmod.f()
        self.assertNotEqual(0, self.mock.call_count)
Example #3
0
    def test_watch_not(self):
        self.tracer.watch("-testmod.A.*")
        with self.tm:
            testmod.f()
        self.assertNotEqual(0, self.mock.call_count)

        self.mock.reset_mock()

        a = testmod.A()
        with self.tm:
            a.m1()
        self.assertEqual(0, self.mock.call_count)
Example #4
0
    def test_watch_not(self):
        self.tracer.watch("-testmod.A.*")
        with self.tm:
            testmod.f()
        self.assertNotEqual(0, self.mock.call_count)

        self.mock.reset_mock()

        a = testmod.A()
        with self.tm:
            a.m1()
        self.assertEqual(0, self.mock.call_count)
Example #5
0
 def test_global_func_qual_name(self):
     q = tracerlib.FrameInspector(testmod.f()).qual_name
     self.assertEqual('testmod.f', q)
Example #6
0
 def test_global_func_qual_name(self):
     q = tracerlib.FrameInspector(testmod.f()).qual_name
     self.assertEqual('testmod.f', q)