def test_no_nested_internal_instance_method_tracing_log_records_when_trace_disabled(
            self):
        named_tracer.setLevel(logging.DEBUG)
        value = TracedClass._TracedClass__InternalNestedClass().method(None)

        self.assertEqual("TC.__INC.m None and None", value)
        self.assertEqual(0, len(list_handler.records))
    def test_nested_internal_instance_method_tracing_log_records(self):
        value = TracedClass._TracedClass__InternalNestedClass().method(None)

        self.assertEqual("TC.__INC.m None and None", value)
        self.assertEqual(2, len(list_handler.records))

        traced_function = (TracedClass._TracedClass__InternalNestedClass.
                           __dict__["method"].__wrapped__)
        expected_logger_name = "traced.testing.%s" % getattr(
            TracedClass._TracedClass__InternalNestedClass, "__qualname__",
            TracedClass._TracedClass__InternalNestedClass.__name__)
        self._assert_call_record(list_handler.records[0], traced_function,
                                 expected_logger_name, ((None, ), dict()),
                                 "TC.__INC.m")
        self._assert_return_record(list_handler.records[1], traced_function,
                                   expected_logger_name,
                                   ("TC.__INC.m None and None", ),
                                   "TC.__INC.m")
Example #3
0
    def test_nested_internal_instance_method_tracing_log_records(self):
        value = TracedClass._TracedClass__InternalNestedClass().method(None)

        self.assertEqual("TC.__INC.m None and None", value)
        self.assertEqual(2, len(list_handler.records))

        traced_function = (
            TracedClass._TracedClass__InternalNestedClass.
                __dict__["method"].__wrapped__)
        expected_logger_name = "traced.testing.%s" % getattr(
            TracedClass._TracedClass__InternalNestedClass, "__qualname__",
            TracedClass._TracedClass__InternalNestedClass.__name__)
        self._assert_call_record(
            list_handler.records[0], traced_function, expected_logger_name,
            ((None,), dict()), "TC.__INC.m")
        self._assert_return_record(
            list_handler.records[1], traced_function, expected_logger_name,
            ("TC.__INC.m None and None",), "TC.__INC.m")
Example #4
0
    def test_no_nested_internal_instance_method_tracing_log_records_when_trace_disabled(self):
        named_tracer.setLevel(logging.DEBUG)
        value = TracedClass._TracedClass__InternalNestedClass().method(None)

        self.assertEqual("TC.__INC.m None and None", value)
        self.assertEqual(0, len(list_handler.records))