From ad58bd23489b3f7a2c05b449966f3d2fe596a4d6 Mon Sep 17 00:00:00 2001 From: Matthias Merdes Date: Mon, 26 Aug 2024 17:17:45 +0200 Subject: [PATCH] cleanup: remove code references to raster data in exceptions and fixtures #815 follow-up to https://github.com/GIScience/ohsome-quality-api/pull/813 https://github.com/GIScience/ohsome-quality-api/issues/815 --- ohsome_quality_api/api/api.py | 6 ------ ohsome_quality_api/utils/exceptions.py | 12 ------------ tests/integrationtests/conftest.py | 12 +----------- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/ohsome_quality_api/api/api.py b/ohsome_quality_api/api/api.py index 577a7c45c..9a7eb7e5a 100644 --- a/ohsome_quality_api/api/api.py +++ b/ohsome_quality_api/api/api.py @@ -72,8 +72,6 @@ from ohsome_quality_api.utils.exceptions import ( HexCellsNotFoundError, OhsomeApiError, - RasterDatasetNotFoundError, - RasterDatasetUndefinedError, SizeRestrictionError, TopicDataSchemaError, ValidationError, @@ -185,8 +183,6 @@ async def validation_exception_handler( @app.exception_handler(HexCellsNotFoundError) @app.exception_handler(TopicDataSchemaError) @app.exception_handler(OhsomeApiError) -@app.exception_handler(RasterDatasetNotFoundError) -@app.exception_handler(RasterDatasetUndefinedError) @app.exception_handler(SizeRestrictionError) @app.exception_handler(ValidationError) async def custom_exception_handler( @@ -194,8 +190,6 @@ async def custom_exception_handler( exception: HexCellsNotFoundError | TopicDataSchemaError | OhsomeApiError - | RasterDatasetNotFoundError - | RasterDatasetUndefinedError | SizeRestrictionError | ValidationError, ): diff --git a/ohsome_quality_api/utils/exceptions.py b/ohsome_quality_api/utils/exceptions.py index ba8f13dfa..fd2322e2a 100644 --- a/ohsome_quality_api/utils/exceptions.py +++ b/ohsome_quality_api/utils/exceptions.py @@ -96,18 +96,6 @@ def __init__(self): ) -class RasterDatasetNotFoundError(FileNotFoundError): - def __init__(self, raster): - self.name = "RasterDatasetNotFoundError" - self.message = "Raster dataset {0} has not been found.".format(raster.name) - - -class RasterDatasetUndefinedError(ValueError): - def __init__(self, raster_name: str): - self.name = "RasterDatasetUndefinedError" - self.message = "Raster dataset {0} is not defined".format(raster_name) - - class TopicDataSchemaError(Exception): def __init__(self, message, schema_error: SchemaError): self.name = "TopicDataSchemaError" diff --git a/tests/integrationtests/conftest.py b/tests/integrationtests/conftest.py index 69d80cf28..116e2d303 100644 --- a/tests/integrationtests/conftest.py +++ b/tests/integrationtests/conftest.py @@ -1,16 +1,6 @@ -import os - import pytest -from tests.integrationtests.utils import get_fixture_dir, get_geojson_fixture - - -@pytest.fixture(scope="class") -def mock_env_oqapi_data_dir(): - directory = os.path.join(get_fixture_dir(), "rasters") - with pytest.MonkeyPatch.context() as mp: - mp.setenv("OQAPI_DATA_DIR", directory) - yield mp +from tests.integrationtests.utils import get_geojson_fixture @pytest.fixture