A7: enable pytest-asyncio (26 skipped async tests now run); fix stale distance assertion in test_geo_service
This commit is contained in:
@@ -13,3 +13,4 @@ pydantic-settings==2.6.1
|
||||
email-validator==2.1.0
|
||||
psycopg2-binary==2.9.12
|
||||
pytest==8.3.4
|
||||
pytest-asyncio==0.24.0
|
||||
|
||||
@@ -22,6 +22,7 @@ from services.geo_service import (
|
||||
build_search_zones,
|
||||
DIRECTIONS,
|
||||
SEARCH_DISTANCES,
|
||||
_build_search_distances,
|
||||
CACHE_DIR
|
||||
)
|
||||
|
||||
@@ -350,7 +351,9 @@ class TestBuildSearchZones:
|
||||
zones = await build_search_zones(53.9, 27.5, {})
|
||||
|
||||
distances_found = set(z.distance_km for z in zones)
|
||||
expected_distances = set(d / 1000 for d in SEARCH_DISTANCES)
|
||||
# build_search_zones derives distances from max_distance_km (default 3.0 km),
|
||||
# not from the legacy SEARCH_DISTANCES constant.
|
||||
expected_distances = set(d / 1000 for d in _build_search_distances(3.0))
|
||||
assert distances_found == expected_distances
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
[pytest]
|
||||
asyncio_mode = auto
|
||||
testpaths = backend/tests
|
||||
markers =
|
||||
asyncio: async test powered by pytest-asyncio
|
||||
Reference in New Issue
Block a user