Skip to content

Commit f820ad3

Browse files
fix lints
1 parent 0d4f740 commit f820ad3

File tree

1 file changed

+18
-6
lines changed

1 file changed

+18
-6
lines changed

tests/profiling_v2/collector/test_threading.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
import os
33
import sys
44
import threading
5-
from typing import Any, Optional, Type, Union
5+
from typing import Any
6+
from typing import Optional
7+
from typing import Type
8+
from typing import Union
69
import uuid
710

811
import mock
@@ -17,14 +20,23 @@
1720
from tests.profiling.collector.lock_utils import init_linenos
1821

1922

23+
# Module-level globals for testing global lock profiling
24+
_test_global_lock = None
25+
_test_global_bar_instance = None
26+
27+
2028
# Type aliases for supported classes
2129
LockClass = Union[Type[threading.Lock], Type[threading.RLock]]
22-
CollectorClass = Union[Type[collector_threading.ThreadingLockCollector], Type[collector_threading.ThreadingRLockCollector]]
30+
CollectorClass = Union[
31+
Type[collector_threading.ThreadingLockCollector], Type[collector_threading.ThreadingRLockCollector]
32+
]
2333

2434

2535
# Type aliases for supported classes
2636
LockClass = Union[Type[threading.Lock], Type[threading.RLock]]
27-
CollectorClass = Union[Type[collector_threading.ThreadingLockCollector], Type[collector_threading.ThreadingRLockCollector]]
37+
CollectorClass = Union[
38+
Type[collector_threading.ThreadingLockCollector], Type[collector_threading.ThreadingRLockCollector]
39+
]
2840

2941
# Module-level globals for testing global lock profiling
3042
_test_global_lock: Optional[Any] = None
@@ -104,7 +116,7 @@ def test_user_threads_have_native_id() -> None:
104116
for _ in range(10):
105117
try:
106118
# The TID should be higher than the PID, but not too high
107-
native_id = getattr(t, 'native_id', None)
119+
native_id = getattr(t, "native_id", None)
108120
if native_id is not None:
109121
assert 0 < native_id - getpid() < 100, (native_id, getpid())
110122
break
@@ -802,11 +814,11 @@ class TestBar:
802814
def __init__(self, lock_class: LockClass) -> None:
803815
self.bar_lock = lock_class() # !CREATE! bar_lock
804816

805-
def bar(self) -> None:
817+
def bar(self):
806818
with self.bar_lock: # !ACQUIRE! !RELEASE! bar_lock
807819
pass
808820

809-
def foo() -> None:
821+
def foo():
810822
global _test_global_lock
811823
assert _test_global_lock is not None
812824
with _test_global_lock: # !ACQUIRE! !RELEASE! _test_global_lock

0 commit comments

Comments
 (0)