Skip to content

Commit 259091d

Browse files
fix tests (import threading)
1 parent 400205b commit 259091d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/profiling_v2/collector/test_threading.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import glob
22
import os
3-
from threading import Lock
4-
from threading import RLock
3+
import threading
54
from typing import Any
65
from typing import Optional
76
from typing import Type
@@ -22,7 +21,7 @@
2221

2322

2423
# Type aliases for supported classes
25-
LockClass = Union[Type[Lock], Type[RLock]]
24+
LockClass = Union[Type[threading.Lock], Type[threading.RLock]]
2625
CollectorClass = Union[Type[ThreadingLockCollector], Type[ThreadingRLockCollector]]
2726

2827
# Module-level globals for testing global lock profiling
@@ -87,8 +86,8 @@ def test_repr(
8786
@pytest.mark.parametrize(
8887
"lock_class,collector_class",
8988
[
90-
(Lock, ThreadingLockCollector),
91-
(RLock, ThreadingRLockCollector),
89+
(threading.Lock, ThreadingLockCollector),
90+
(threading.RLock, ThreadingRLockCollector),
9291
],
9392
)
9493
def test_patch(
@@ -111,6 +110,7 @@ def test_patch(
111110
)
112111
def test_wrapt_disable_extensions():
113112
import os
113+
import threading
114114

115115
from ddtrace.internal.datadog.profiling import ddup
116116
from ddtrace.profiling.collector import _lock
@@ -137,7 +137,7 @@ def test_wrapt_disable_extensions():
137137
assert _lock.WRAPT_C_EXT is False
138138

139139
with ThreadingLockCollector(capture_pct=100):
140-
th_lock = Lock() # !CREATE! test_wrapt_disable_extensions
140+
th_lock = threading.Lock() # !CREATE! test_wrapt_disable_extensions
141141
with th_lock: # !ACQUIRE! !RELEASE! test_wrapt_disable_extensions
142142
pass
143143

@@ -973,7 +973,7 @@ def collector_class(self):
973973

974974
@property
975975
def lock_class(self):
976-
return Lock
976+
return threading.Lock
977977

978978

979979
class TestThreadingRLockCollector(BaseThreadingLockCollectorTest):
@@ -985,4 +985,4 @@ def collector_class(self):
985985

986986
@property
987987
def lock_class(self):
988-
return RLock
988+
return threading.RLock

0 commit comments

Comments
 (0)