Skip to content

Commit a0c145b

Browse files
Need to find another way to stop the logging with Open Telemetry
1 parent 0252406 commit a0c145b

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
@pytest.fixture(autouse=True)
1717
def disable_logging(monkeypatch):
1818
"""Disable logging to Application Insight"""
19-
monkeypatch.setattr("datareservoirio.client.AzureLogHandler", logging.NullHandler())
19+
20+
21+
# monkeypatch.setattr("datareservoirio.client.AzureLogHandler", logging.NullHandler())
2022

2123

2224
@pytest.fixture

tests/test__logging.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ def my_class():
2525
my_class = my_test_class()
2626
my_class.logging_as_exception = False
2727
my_class.logging_as_warning = False
28-
exceptions_logger.exception = types.MethodType(change_logging, my_class)
29-
exceptions_logger.warning = types.MethodType(change_logging_warning, my_class)
28+
exceptions_logger().exception = types.MethodType(change_logging, my_class)
29+
exceptions_logger().warning = types.MethodType(change_logging_warning, my_class)
3030

3131
return my_class
3232

tests/test_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def test__init__(self, auth_session, tmp_path):
104104
drio.Client(auth_session, cache=True, cache_opt=cache_opt)
105105

106106
def client_error_handler(self, client, method):
107-
exceptions_logger.exception = types.MethodType(change_logging, client)
107+
exceptions_logger().exception = types.MethodType(change_logging, client)
108108
client._auth_session.get = types.MethodType(method, client._auth_session)
109109
return client
110110

@@ -946,7 +946,7 @@ def test_remove_metadata(self, client, response_cases, mock_requests):
946946

947947
def test_client_get_throws_exception_is_logged(self, client):
948948
client.was_called = False
949-
exceptions_logger.exception = types.MethodType(change_logging, client)
949+
exceptions_logger().exception = types.MethodType(change_logging, client)
950950
with pytest.raises(ValueError):
951951
client.get("e3d82cda-4737-4af9-8d17-d9dfda8703d0", raise_empty=True)
952952
assert client.was_called == True

0 commit comments

Comments
 (0)