Skip to content

Commit fa61bb2

Browse files
committed
psycopg2 tests
1 parent 85101f9 commit fa61bb2

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

instrumentation/opentelemetry-instrumentation-psycopg2/tests/test_psycopg2_instrumentation.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,17 @@ def _distribution(name):
137137
# Note there is only one test here but it is run twice in tox
138138
# once with the psycopg2 package installed and once with
139139
# psycopg2-binary installed.
140+
@patch(
141+
"opentelemetry.instrumentation.auto_instrumentation._load.get_dist_dependency_conflicts"
142+
)
140143
@patch("opentelemetry.instrumentation.auto_instrumentation._load._logger")
141-
def test_instruments_with_psycopg2_installed(self, mock_logger):
144+
def test_instruments_with_psycopg2_installed(self, mock_logger, mock_dep):
142145
def _instrumentation_loaded_successfully_call():
143146
return call("Instrumented %s", "psycopg2")
144147

145148
mock_distro = Mock()
149+
# TODO: This test previously did nothing. By mocking the distro, it blocks any possibility of a dependency conflict. Mocking no dependency conflict for no. But, in the future, update this package toml with the instruemnts_either field.
150+
mock_dep.return_value = None
146151
mock_distro.load_instrumentor.return_value = None
147152
_load_instrumentors(mock_distro)
148153
self.assertEqual(len(mock_distro.load_instrumentor.call_args_list), 1)

0 commit comments

Comments
 (0)