diff --git a/tests/opentelemetry-docker-tests/tests/asyncpg/test_asyncpg_functional.py b/tests/opentelemetry-docker-tests/tests/asyncpg/test_asyncpg_functional.py index 87382702f2a..cb9080e62c2 100644 --- a/tests/opentelemetry-docker-tests/tests/asyncpg/test_asyncpg_functional.py +++ b/tests/opentelemetry-docker-tests/tests/asyncpg/test_asyncpg_functional.py @@ -14,7 +14,7 @@ POSTGRES_USER = os.getenv("POSTGRESQL_HOST ", "testuser") -def _await(coro): +def async_call(coro): loop = asyncio.get_event_loop() return loop.run_until_complete(coro) @@ -27,7 +27,7 @@ def setUpClass(cls): cls._cursor = None cls._tracer = cls.tracer_provider.get_tracer(__name__) AsyncPGInstrumentor().instrument(tracer_provider=cls.tracer_provider) - cls._connection = _await( + cls._connection = async_call( asyncpg.connect( database=POSTGRES_DB_NAME, user=POSTGRES_USER, @@ -42,7 +42,7 @@ def tearDownClass(cls): AsyncPGInstrumentor().uninstrument() def test_instrumented_execute_method_without_arguments(self, *_, **__): - _await(self._connection.execute("SELECT 42;")) + async_call(self._connection.execute("SELECT 42;")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -59,7 +59,7 @@ def test_instrumented_execute_method_without_arguments(self, *_, **__): ) def test_instrumented_fetch_method_without_arguments(self, *_, **__): - _await(self._connection.fetch("SELECT 42;")) + async_call(self._connection.fetch("SELECT 42;")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -77,7 +77,7 @@ async def _transaction_execute(): async with self._connection.transaction(): await self._connection.execute("SELECT 42;") - _await(_transaction_execute()) + async_call(_transaction_execute()) spans = self.memory_exporter.get_finished_spans() self.assertEqual(3, len(spans)) @@ -124,7 +124,7 @@ async def _transaction_execute(): await self._connection.execute("SELECT 42::uuid;") with self.assertRaises(asyncpg.CannotCoerceError): - _await(_transaction_execute()) + async_call(_transaction_execute()) spans = self.memory_exporter.get_finished_spans() self.assertEqual(3, len(spans)) @@ -167,7 +167,7 @@ async def _transaction_execute(): ) def test_instrumented_method_doesnt_capture_parameters(self, *_, **__): - _await(self._connection.execute("SELECT $1;", "1")) + async_call(self._connection.execute("SELECT $1;", "1")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -198,7 +198,7 @@ def setUpClass(cls): AsyncPGInstrumentor(capture_parameters=True).instrument( tracer_provider=cls.tracer_provider ) - cls._connection = _await( + cls._connection = async_call( asyncpg.connect( database=POSTGRES_DB_NAME, user=POSTGRES_USER, @@ -213,7 +213,7 @@ def tearDownClass(cls): AsyncPGInstrumentor().uninstrument() def test_instrumented_execute_method_with_arguments(self, *_, **__): - _await(self._connection.execute("SELECT $1;", "1")) + async_call(self._connection.execute("SELECT $1;", "1")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -231,7 +231,7 @@ def test_instrumented_execute_method_with_arguments(self, *_, **__): ) def test_instrumented_fetch_method_with_arguments(self, *_, **__): - _await(self._connection.fetch("SELECT $1;", "1")) + async_call(self._connection.fetch("SELECT $1;", "1")) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -246,7 +246,7 @@ def test_instrumented_fetch_method_with_arguments(self, *_, **__): ) def test_instrumented_executemany_method_with_arguments(self, *_, **__): - _await(self._connection.executemany("SELECT $1;", [["1"], ["2"]])) + async_call(self._connection.executemany("SELECT $1;", [["1"], ["2"]])) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual( @@ -262,7 +262,7 @@ def test_instrumented_executemany_method_with_arguments(self, *_, **__): def test_instrumented_execute_interface_error_method(self, *_, **__): with self.assertRaises(asyncpg.InterfaceError): - _await(self._connection.execute("SELECT 42;", 1, 2, 3)) + async_call(self._connection.execute("SELECT 42;", 1, 2, 3)) spans = self.memory_exporter.get_finished_spans() self.assertEqual(len(spans), 1) self.assertEqual(