diff --git a/surveyscout/tasks/compute_cost/__init__.py b/surveyscout/tasks/compute_cost/__init__.py index e51e15c..48e0dc9 100644 --- a/surveyscout/tasks/compute_cost/__init__.py +++ b/surveyscout/tasks/compute_cost/__init__.py @@ -1,11 +1,15 @@ from surveyscout.tasks.compute_cost.haversine import get_enum_target_haversine_matrix -from surveyscout.tasks.compute_cost.osrm import get_enum_target_osrm_matrix_async +from surveyscout.tasks.compute_cost.osrm import ( + get_enum_target_osrm_matrix, + get_enum_target_osrm_matrix_async, +) from surveyscout.tasks.compute_cost.google_distance_matrix import ( get_enum_target_google_distance_matrix, ) __all__ = [ "get_enum_target_haversine_matrix", + "get_enum_target_osrm_matrix", "get_enum_target_osrm_matrix_async", "get_enum_target_google_distance_matrix", ] diff --git a/tests/conftest.py b/tests/conftest.py index 34a6d12..da61578 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -76,6 +76,10 @@ def patch_osrm_call(monkeysession: pytest.MonkeyPatch) -> None: "surveyscout.tasks.compute_cost.osrm._get_enum_target_matrix_osrm", mock_return_matrix, ) + monkeysession.setattr( + "surveyscout.tasks.compute_cost.osrm._get_enum_target_matrix_osrm_async", + mock_return_matrix, + ) success_element = { diff --git a/tests/test_tasks/test_compute_cost.py b/tests/test_tasks/test_compute_cost.py index 3fc1176..43ba5a7 100644 --- a/tests/test_tasks/test_compute_cost.py +++ b/tests/test_tasks/test_compute_cost.py @@ -3,6 +3,7 @@ import pytest from surveyscout.tasks.compute_cost import ( get_enum_target_haversine_matrix, + get_enum_target_osrm_matrix, get_enum_target_osrm_matrix_async, get_enum_target_google_distance_matrix, ) @@ -23,7 +24,7 @@ def enum_target_haversine_matrix( @pytest.fixture(scope="module") -def enum_target_osrm_matrix( +def enum_target_osrm_matrix_async( enum_locs: LocationDataset, target_locs: LocationDataset ) -> NDArray: return get_enum_target_osrm_matrix_async( @@ -31,6 +32,15 @@ def enum_target_osrm_matrix( ) +@pytest.fixture(scope="module") +def enum_target_osrm_matrix( + enum_locs: LocationDataset, target_locs: LocationDataset +) -> NDArray: + return get_enum_target_osrm_matrix( + enum_locations=enum_locs, target_locations=target_locs + ) + + @pytest.fixture(scope="module") def enum_target_google_distance_matrix( enum_locs: LocationDataset, target_locs: LocationDataset @@ -40,13 +50,15 @@ def enum_target_google_distance_matrix( ) -@pytest.fixture(params=["osrm", "haversine", "google"]) +@pytest.fixture(params=["osrm", "osrm_async", "haversine", "google"]) def cost_matrix( request: pytest.FixtureRequest, enum_locs: LocationDataset, target_locs: LocationDataset, ) -> NDArray: if request.param == "osrm": + return get_enum_target_osrm_matrix(enum_locs, target_locs) + if request.param == "osrm_async": return get_enum_target_osrm_matrix_async(enum_locs, target_locs) if request.param == "haversine": return get_enum_target_haversine_matrix(enum_locs, target_locs)