Skip to content

Warnings about non closes sockets on windows during test suite #6501

Open

Description

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

Activity

  1. jenshnielsen commented on Oct 8, 2024

    @jenshnielsen
    CollaboratorAuthor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions