Skip to content

Commit

Permalink
cleanup: remove code references to raster data in exceptions and fixt…
Browse files Browse the repository at this point in the history
…ures #815

follow-up to #813

#815
  • Loading branch information
mmerdes committed Aug 26, 2024
1 parent 2c84e71 commit ad58bd2
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
6 changes: 0 additions & 6 deletions ohsome_quality_api/api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,6 @@
from ohsome_quality_api.utils.exceptions import (
HexCellsNotFoundError,
OhsomeApiError,
RasterDatasetNotFoundError,
RasterDatasetUndefinedError,
SizeRestrictionError,
TopicDataSchemaError,
ValidationError,
Expand Down Expand Up @@ -185,17 +183,13 @@ 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(
_: Request,
exception: HexCellsNotFoundError
| TopicDataSchemaError
| OhsomeApiError
| RasterDatasetNotFoundError
| RasterDatasetUndefinedError
| SizeRestrictionError
| ValidationError,
):
Expand Down
12 changes: 0 additions & 12 deletions ohsome_quality_api/utils/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
12 changes: 1 addition & 11 deletions tests/integrationtests/conftest.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit ad58bd2

Please sign in to comment.