def test_call_method_tracing_log_records(self): obj = TracedClass() list_handler.reset() rv = obj() self.assertEqual("TC.__call__", rv) self.assertEqual(2, len(list_handler.records)) traced_function = TracedClass.__dict__["__call__"].__wrapped__ self._assert_call_record( list_handler.records[0], traced_function, "test.dummy.TracedClass", (tuple(), dict()), "TC.__c__") self._assert_return_record( list_handler.records[1], traced_function, "test.dummy.TracedClass", ("TC.__call__",), "TC.__c__")
def test_call_method_tracing_log_records(self): obj = TracedClass() list_handler.reset() rv = obj() self.assertEqual("TC.__call__", rv) self.assertEqual(2, len(list_handler.records)) traced_function = TracedClass.__dict__["__call__"].__wrapped__ self._assert_call_record(list_handler.records[0], traced_function, "test.dummy.TracedClass", (tuple(), dict()), "TC.__c__") self._assert_return_record(list_handler.records[1], traced_function, "test.dummy.TracedClass", ("TC.__call__", ), "TC.__c__")
def test_call_method_log_and_trace_records(self): obj = LoggedAndTracedClass.NestedClass() list_handler.reset() rv = obj("test") self.assertEqual("LATC.NC.__call__ test", rv) self.assertEqual(3, len(list_handler.records)) wrapped_function = \ LoggedAndTracedClass.NestedClass.__dict__["__call__"].__wrapped__ qualname = getattr(LoggedAndTracedClass.NestedClass, "__qualname__", "NestedClass") expected_tracer_name = "test.dummy.%s" % qualname expected_logger_name = "logged.testing.%s" % qualname self._assert_call_record(list_handler.records[0], wrapped_function, expected_tracer_name, (("test", ), dict()), "LATC.NC.__c__") self._assert_log_record(list_handler.records[1], wrapped_function, expected_logger_name, "LATC.NC.__c__") self._assert_return_record(list_handler.records[2], wrapped_function, expected_tracer_name, ("LATC.NC.__call__ test", ), "LATC.NC.__c__")
def test_call_method_log_and_trace_records(self): obj = LoggedAndTracedClass.NestedClass() list_handler.reset() rv = obj("test") self.assertEqual("LATC.NC.__call__ test", rv) self.assertEqual(3, len(list_handler.records)) wrapped_function = \ LoggedAndTracedClass.NestedClass.__dict__["__call__"].__wrapped__ qualname = getattr( LoggedAndTracedClass.NestedClass, "__qualname__", "NestedClass") expected_tracer_name = "test.dummy.%s" % qualname expected_logger_name = "logged.testing.%s" % qualname self._assert_call_record( list_handler.records[0], wrapped_function, expected_tracer_name, (("test",), dict()), "LATC.NC.__c__") self._assert_log_record( list_handler.records[1], wrapped_function, expected_logger_name, "LATC.NC.__c__") self._assert_return_record( list_handler.records[2], wrapped_function, expected_tracer_name, ("LATC.NC.__call__ test",), "LATC.NC.__c__")
def setUp(self): list_handler.reset() named_tracer.setLevel(logging.NOTSET)
def setUp(self): dummy_module_logger.setLevel(TRACE) named_logger.setLevel(TRACE) named_tracer.setLevel(TRACE) list_handler.reset()
def setUp(self): list_handler.reset() named_tracer.setLevel(logging.NOTSET)
def setUp(self): dummy_module_logger.setLevel(logging.INFO) named_logger.setLevel(logging.INFO) list_handler.reset()
def setUp(self): dummy_module_logger.setLevel(TRACE) named_logger.setLevel(TRACE) named_tracer.setLevel(TRACE) list_handler.reset()
def setUp(self): list_handler.reset()
def setUp(self): dummy_module_logger.setLevel(logging.INFO) named_logger.setLevel(logging.INFO) list_handler.reset()
def setUp(self): list_handler.reset()