diff --git a/tests/test_catalog.py b/tests/test_catalog.py index aed296e22..ce956667a 100644 --- a/tests/test_catalog.py +++ b/tests/test_catalog.py @@ -939,7 +939,7 @@ def test_collections_cache_correctly(self) -> None: def test_reading_iterating_and_writing_works_as_expected(self) -> None: """Test case to cover issue #88""" - stac_uri = "tests/data-files/catalogs/test-case-6/catalog.json" + stac_uri = TestCases.get_path("data-files/catalogs/test-case-6/catalog.json") cat = Catalog.from_file(stac_uri) # Iterate over the items. This was causing failure in diff --git a/tests/test_item_collection.py b/tests/test_item_collection.py index 14c1116cb..60c711277 100644 --- a/tests/test_item_collection.py +++ b/tests/test_item_collection.py @@ -2,6 +2,8 @@ import json from pystac.item_collection import ItemCollection import unittest +from os.path import relpath + import pystac from tests.utils import TestCases @@ -101,7 +103,11 @@ def test_raise_error_for_invalid_object(self) -> None: def test_from_relative_path(self) -> None: _ = pystac.ItemCollection.from_file( - "./tests/data-files/item-collection/sample-item-collection.json" + relpath( + TestCases.get_path( + "data-files/item-collection/sample-item-collection.json" + ) + ) ) def test_from_list_of_dicts(self) -> None: diff --git a/tests/test_utils.py b/tests/test_utils.py index ae4e4cb9c..4f6e1d849 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -8,6 +8,7 @@ from pystac import utils from pystac.utils import make_relative_href, make_absolute_href, is_absolute_href +from tests.utils import TestCases class UtilsTest(unittest.TestCase): @@ -273,7 +274,9 @@ def test_datetime_to_str(self) -> None: def test_geojson_bbox(self) -> None: # Use sample Geojson from https://en.wikipedia.org/wiki/GeoJSON - with open("tests/data-files/geojson/sample.geojson") as sample_geojson: + with open( + TestCases.get_path("data-files/geojson/sample.geojson") + ) as sample_geojson: all_features = json.load(sample_geojson) geom_dicts = [f["geometry"] for f in all_features["features"]] for geom in geom_dicts: