Skip to content

Commit ac1cb5b

Browse files
author
rodrigo.nogueira
committed
Add Windows socket warning filter for Py3.10/3.11
1 parent 4d75c6a commit ac1cb5b

File tree

2 files changed

+7
-19
lines changed

2 files changed

+7
-19
lines changed

tests/conftest.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@
4949
TRUSTME = False
5050

5151

52+
def pytest_configure(config: pytest.Config) -> None:
53+
if os.name == "nt" and sys.version_info[:2] in ((3, 10), (3, 11)):
54+
config.addinivalue_line(
55+
"filterwarnings",
56+
"ignore:Exception ignored in.*socket.*:pytest.PytestUnraisableExceptionWarning",
57+
)
58+
5259
try:
5360
if sys.platform == "win32":
5461
import winloop as uvloop

tests/test_proxy_functional.py

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -66,13 +66,6 @@ def secure_proxy_url(tls_certificate_pem_path: str) -> Iterator[URL]:
6666
6767
This fixture also spawns that instance and tears it down after the test.
6868
"""
69-
if os.name == "nt":
70-
import gc
71-
import threading
72-
import time
73-
74-
baseline_threads = set(threading.enumerate())
75-
7669
proxypy_args = [
7770
# --threadless does not work on windows, see
7871
# https://github.com/abhinavsingh/proxy.py/issues/492
@@ -96,18 +89,6 @@ def secure_proxy_url(tls_certificate_pem_path: str) -> Iterator[URL]:
9689
port=proxy_instance.flags.port,
9790
)
9891

99-
if os.name == "nt":
100-
deadline = time.monotonic() + 5.0
101-
while time.monotonic() < deadline:
102-
gc.collect()
103-
new_threads = set(threading.enumerate()) - baseline_threads
104-
if not new_threads:
105-
break
106-
time.sleep(0.05)
107-
for _ in range(3):
108-
gc.collect()
109-
time.sleep(0.1)
110-
11192

11293
@pytest.fixture
11394
def web_server_endpoint_payload() -> str:

0 commit comments

Comments
 (0)