修复测试:AMSC/NMC 测试适配环境变量 URL 模式

This commit is contained in:
2569718930@qq.com
2026-05-19 15:56:28 +08:00
parent 6b741cc1ec
commit 49238cf420
2 changed files with 6 additions and 3 deletions
+4 -2
View File
@@ -40,7 +40,8 @@ class _DummyCollector(NmcSourceMixin):
self._nmc_cache_lock = threading.Lock()
def test_fetch_nmc_region_current_parses_rest_payload():
def test_fetch_nmc_region_current_parses_rest_payload(monkeypatch):
monkeypatch.setenv("NMC_REALTIME_BASE_URL", "https://www.nmc.cn/rest/real")
collector = _DummyCollector(
{
"https://www.nmc.cn/rest/real/atcMf": _DummyResponse(
@@ -70,7 +71,8 @@ def test_fetch_nmc_region_current_parses_rest_payload():
assert out["current"]["airpressure"] is None
def test_fetch_nmc_official_nearby_returns_normalized_row():
def test_fetch_nmc_official_nearby_returns_normalized_row(monkeypatch):
monkeypatch.setenv("NMC_REALTIME_BASE_URL", "https://www.nmc.cn/rest/real")
collector = _DummyCollector(
{
"https://www.nmc.cn/rest/real/atcMf": _DummyResponse(