Skip to content

Commit a6adfd8

Browse files
blarghmateyCopilot
andcommitted
Fix asyncpg test: use BaseObjectProxy compat shim for wrapt 2.x
In wrapt 2.x, BoundFunctionWrapper no longer subclasses ObjectProxy (it subclasses BaseObjectProxy instead). Update the test to use the compat shim so isinstance checks pass with both wrapt 1.x and 2.x. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent f0a3a2f commit a6adfd8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

instrumentation/opentelemetry-instrumentation-asyncpg/tests/test_asyncpg_wrapper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33

44
import pytest
55
from asyncpg import Connection, Record, cursor
6-
from wrapt import ObjectProxy
6+
7+
try:
8+
from wrapt import BaseObjectProxy # pylint: disable=no-name-in-module
9+
except ImportError:
10+
from wrapt import ObjectProxy as BaseObjectProxy
711

812
from opentelemetry import trace as trace_api
913
from opentelemetry.instrumentation.asyncpg import AsyncPGInstrumentor
@@ -50,7 +54,7 @@ def assert_wrapped(assert_fnc):
5054
for method_name in methods:
5155
method = getattr(cls, method_name, None)
5256
assert_fnc(
53-
isinstance(method, ObjectProxy),
57+
isinstance(method, BaseObjectProxy),
5458
f"{method} isinstance {type(method)}",
5559
)
5660

0 commit comments

Comments
 (0)