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:
Yijia-Xiao
2026-09-24 05:00:36 +00:00
parent 1e9ad314d8
commit 91c4319147
3 changed files with 35 additions and 0 deletions
+4
View File
@@ -34,6 +34,10 @@ class TestLoadOhlcvNoPoison(unittest.TestCase):
def test_empty_download_raises_and_does_not_cache(self):
empty = pd.DataFrame()
# Yahoo answers, so an empty download means the symbol has no data.
reachable = mock.patch.object(ohlcv, "vendor_reachable", return_value=True)
reachable.start()
self.addCleanup(reachable.stop)
with mock.patch.object(ohlcv.yf, "download", return_value=empty), \
self.assertRaises(NoMarketDataError):
ohlcv.load_ohlcv("FAKE", "2026-01-01")