From 0f7dd5dc8427e2d2f048db0c4676cd2cc38fea02 Mon Sep 17 00:00:00 2001 From: Claude Agent Date: Fri, 17 Apr 2026 11:00:40 +0000 Subject: [PATCH] fix(deps+tests): move httpx to prod deps; stub Poller+Scheduler in sync test httpx was in dev deps only, causing ImportError for users doing `pip install -e .` since atm.commands imports httpx at module level. Moved to main dependencies. Also stubs TelegramPoller and ScreenshotScheduler in the sync catchup test to prevent flaky CI failures from attempted real network connections. Co-Authored-By: Claude Sonnet 4.6 --- pyproject.toml | 2 +- tests/test_main.py | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a5a56c2..b6bb738 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -13,6 +13,7 @@ dependencies = [ "pillow>=10.0", "requests>=2.31", "rich>=13.0", + "httpx>=0.27", ] [project.optional-dependencies] @@ -25,7 +26,6 @@ dev = [ "pytest>=8.0", "pytest-cov>=5.0", "pytest-asyncio>=0.23", - "httpx>=0.27", ] [project.scripts] diff --git a/tests/test_main.py b/tests/test_main.py index 39a380b..4626726 100644 --- a/tests/test_main.py +++ b/tests/test_main.py @@ -229,6 +229,17 @@ def test_run_live_catchup_sell_from_gray_then_dark_red(monkeypatch, tmp_path): def step(self, *a, **kw): return types.SimpleNamespace(status="pending", levels=None) + class _StubPoller: + def __init__(self, *a, **kw): pass + async def run(self): await asyncio.sleep(9999) + + class _StubScheduler: + def __init__(self, *a, **kw): + self.is_running = False + def start(self, interval_s): self.is_running = True + def stop(self): self.is_running = False + async def run(self): await asyncio.sleep(9999) + monkeypatch.setattr("atm.detector.Detector", ScriptedDetector) monkeypatch.setattr("atm.canary.Canary", FakeCanary) monkeypatch.setattr("atm.notifier.fanout.FanoutNotifier", FakeFanout) @@ -238,6 +249,8 @@ def test_run_live_catchup_sell_from_gray_then_dark_red(monkeypatch, tmp_path): monkeypatch.setattr("atm.levels.LevelsExtractor", _Stub) monkeypatch.setattr("atm.main._build_capture", fake_build_capture) monkeypatch.setattr("atm.main.time.sleep", lambda s: None) + monkeypatch.setattr("atm.commands.TelegramPoller", _StubPoller) + monkeypatch.setattr("atm.scheduler.ScreenshotScheduler", _StubScheduler) with pytest.raises(_StopLoop): _main.run_live(cfg, duration_s=None)