Skip to content

Commit

Permalink
Linter changes
Browse files Browse the repository at this point in the history
Signed-off-by: Kowshik BV <[email protected]>
  • Loading branch information
kaushik95 committed Aug 27, 2024
1 parent 8bff533 commit ebd1695
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,23 +262,23 @@ def test_sqlcommenter_enabled(self, event_mocked):
self.assertEqual(kwargs["enable_commenter"], True)

@mock.patch("opentelemetry.instrumentation.dbapi.wrap_connect")
def test_sqlcommenter_enabled_no_op_tracer(self, event_mocked):
tracer_provider = trace.NoOpTracerProvider()
trace.set_tracer_provider(tracer_provider)
def test_sqlcommenter_disabled(self, event_mocked):
cnx = psycopg2.connect(database="test")
Psycopg2Instrumentor().instrument(tracer_provider=tracer_provider, enable_commenter=True)
Psycopg2Instrumentor().instrument()
query = "SELECT * FROM test"
cursor = cnx.cursor()
cursor.execute(query)
kwargs = event_mocked.call_args[1]
self.assertEqual(kwargs["enable_commenter"], True)
self.assertEqual(kwargs["enable_commenter"], False)

@mock.patch("opentelemetry.instrumentation.dbapi.wrap_connect")
def test_sqlcommenter_disabled(self, event_mocked):
def test_sqlcommenter_enabled_no_op_tracer(self, event_mocked):
cnx = psycopg2.connect(database="test")
Psycopg2Instrumentor().instrument()
Psycopg2Instrumentor().instrument(
tracer_provider=trace.NoOpTracerProvider(), enable_commenter=True
)
query = "SELECT * FROM test"
cursor = cnx.cursor()
cursor.execute(query)
kwargs = event_mocked.call_args[1]
self.assertEqual(kwargs["enable_commenter"], False)
self.assertEqual(kwargs["enable_commenter"], True)

0 comments on commit ebd1695

Please sign in to comment.