mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-09-27 15:02:39 +03:00
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
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
"""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()
|
||||
Reference in New Issue
Block a user