2929# limitations under the License.
3030from importlib .metadata import PackageNotFoundError
3131from unittest import TestCase
32- from unittest .mock import call , patch , Mock
32+ from unittest .mock import Mock , call , patch
3333
34+ from opentelemetry .instrumentation .auto_instrumentation ._load import (
35+ _load_instrumentors ,
36+ )
3437from opentelemetry .instrumentation .psycopg2 import Psycopg2Instrumentor
3538from opentelemetry .instrumentation .psycopg2 .package import (
3639 _instruments ,
3740 _instruments_psycopg2 ,
3841 _instruments_psycopg2_binary ,
3942)
40- from opentelemetry .instrumentation .auto_instrumentation ._load import (
41- _load_instrumentors ,
42- )
43-
4443
4544
4645class TestPsycopg2InstrumentationDependencies (TestCase ):
@@ -99,7 +98,7 @@ def _distribution(name):
9998 [
10099 call ("psycopg2" ),
101100 call ("psycopg2-binary" ),
102- ]
101+ ],
103102 )
104103 self .assertEqual (
105104 package_to_instrument , (_instruments_psycopg2_binary ,)
@@ -121,12 +120,8 @@ def _distribution(name):
121120 package_to_instrument = instrumentation .instrumentation_dependencies ()
122121
123122 self .assertEqual (mock_distribution .call_count , 1 )
124- self .assertEqual (
125- mock_distribution .mock_calls , [call ("psycopg2" )]
126- )
127- self .assertEqual (
128- package_to_instrument , (_instruments_psycopg2 ,)
129- )
123+ self .assertEqual (mock_distribution .mock_calls , [call ("psycopg2" )])
124+ self .assertEqual (package_to_instrument , (_instruments_psycopg2 ,))
130125
131126 @patch ("opentelemetry.instrumentation.psycopg2.distribution" )
132127 def test_instrumentation_dependencies_none_installed (
@@ -168,7 +163,6 @@ def _distribution(name):
168163 # psycopg2-binary installed.
169164 @patch ("opentelemetry.instrumentation.auto_instrumentation._load._logger" )
170165 def test_instruments_with_psycopg2_installed (self , mock_logger ):
171-
172166 def _instrumentation_loaded_successfully_call ():
173167 return call ("Instrumented %s" , "psycopg2" )
174168
0 commit comments