Files
tradingagents/tests/test_suite_isolation.py
T
Yijia-Xiao 91c4319147 test: keep tests off the network
- conftest refuses socket connections outside tests marked integration
- the one test that probed Yahoo for real now stubs the reachability check
2026-09-24 05:00:36 +00:00

18 lines
599 B
Python

"""The suite runs the same on any machine: no test reaches the network."""
import socket
import pytest
@pytest.mark.unit
@pytest.mark.parametrize("connect", [
lambda: socket.create_connection(("192.0.2.1", 80), timeout=1),
lambda: socket.socket().connect_ex(("192.0.2.1", 80)),
], ids=["connect", "connect_ex"])
def test_a_test_cannot_reach_the_network(connect):
"""A test that silently depends on a live vendor passes or fails with the
machine it runs on; conftest refuses the connection instead."""
with pytest.raises(OSError, match="reach the network"):
connect()