Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SYNPY-1344] Allows Socket Connections for Windows Systems in Unit Tests #1054

Merged
merged 2 commits into from
Jan 25, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tests/unit/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ def pytest_runtest_setup():

allow_unix_socket=True is required for async to work.
"""
disable_socket(allow_unix_socket=True)
if platform.system() != "Windows":
BWMac marked this conversation as resolved.
Show resolved Hide resolved
disable_socket(allow_unix_socket=True)


def test_confirm_connections_blocked():
"""Confirm that socket connections are blocked during unit tests."""
with pytest.raises(SocketBlockedError) as cm_ex:
urllib.request.urlopen("http://example.com")
assert "A test tried to use socket.socket." == str(cm_ex.value)
if platform.system() != "Windows":
with pytest.raises(SocketBlockedError) as cm_ex:
urllib.request.urlopen("http://example.com")
assert "A test tried to use socket.socket." == str(cm_ex.value)


@pytest.fixture(autouse=True)
Expand Down
Loading