Qcodes
Qcodes copied to clipboard
Warnings about non closes sockets on windows during test suite
Run the test suite and you will see warnings like
Exception ignored in: <socket.socket fd=1088, family=2, type=1, proto=0, laddr=('127.0.0.1', 56248), raddr=('127.0.0.1', 56249)>
Traceback (most recent call last):
File "C:\Users\jenielse\AppData\Roaming\uv\data\python\cpython-3.12.7-windows-x86_64-none\Lib\threading.py", line 1016, in run
del self._target, self._args, self._kwargs
^^^^^^^^^^
ResourceWarning: unclosed <socket.socket fd=1088, family=2, type=1, proto=0, laddr=('127.0.0.1', 56248), raddr=('127.0.0.1', 56249)>
A bit of digging seems to indicate that this relates to a combination of pytest-xdist and hypothesis.
The following no-op test triggers the warning when run using xdist with n > 0
import hypothesis.strategies as hst
from hypothesis import given
@given(n_points_pws=hst.integers(min_value=1, max_value=500))
def test_pytest_min_warning(
n_points_pws,
) -> None:
pass
https://github.com/HypothesisWorks/hypothesis/issues/4130