Skip to content

Commit

Permalink
feat, tests: add fixtures for prebuilt catalogs
Browse files Browse the repository at this point in the history
I don't love the name "prebuilt" but I can't think of a better one.
  • Loading branch information
gadomski committed Feb 21, 2023
1 parent 0ddad8b commit 1ac2b63
Showing 1 changed file with 40 additions and 1 deletion.
41 changes: 40 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,56 @@
from datetime import datetime

import pytest
from pytest import FixtureRequest

from pystac import Catalog, Collection, Item

from .utils import ARBITRARY_BBOX, ARBITRARY_EXTENT, ARBITRARY_GEOM
from .utils import ARBITRARY_BBOX, ARBITRARY_EXTENT, ARBITRARY_GEOM, TestCases


@pytest.fixture
def catalog() -> Catalog:
return Catalog("test-catalog", "A test catalog")


@pytest.fixture
def prebuilt_catalog_1() -> Catalog:
path = TestCases.get_path("data-files/catalogs/test-case-1/catalog.json")
return Catalog.from_file(path)


@pytest.fixture
def prebuilt_catalog_2() -> Catalog:
path = TestCases.get_path("data-files/catalogs/test-case-2/catalog.json")
return Catalog.from_file(path)


@pytest.fixture
def prebuilt_catalog_4() -> Catalog:
path = TestCases.get_path("data-files/catalogs/test-case-4/catalog.json")
return Catalog.from_file(path)


@pytest.fixture
def prebuilt_catalog_5() -> Catalog:
path = TestCases.get_path("data-files/catalogs/test-case-5/catalog.json")
return Catalog.from_file(path)


@pytest.fixture
def prebuilt_catalog_6() -> Catalog:
path = TestCases.get_path("data-files/catalogs/test-case-6/catalog.json")
return Catalog.from_file(path)


@pytest.fixture(params=["1", "2", "4", "5", "6"])
def prebuilt_catalog(request: FixtureRequest) -> Catalog:
path = TestCases.get_path(
f"data-files/catalogs/test-case-{request.param}/catalog.json"
)
return Catalog.from_file(path)


@pytest.fixture
def collection() -> Catalog:
return Collection("test-collection", "A test collection", ARBITRARY_EXTENT)
Expand Down

0 comments on commit 1ac2b63

Please sign in to comment.