Skip to content

Commit

Permalink
feat: use pytest
Browse files Browse the repository at this point in the history
Instead of a custom validate script, just use pytest
  • Loading branch information
gadomski committed Oct 9, 2023
1 parent 73b5c86 commit 66b8a6a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 42 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:

jobs:
validate:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand All @@ -19,5 +19,5 @@ jobs:
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Validate collections
run: python scripts/validate_collections.py
- name: Test collections
run: pytest
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
pip-tools
pystac[validation]
pytest
10 changes: 9 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,26 @@ build==1.0.3
# via pip-tools
click==8.1.7
# via pip-tools
iniconfig==2.0.0
# via pytest
jsonschema==4.17.3
# via pystac
packaging==23.1
# via build
# via
# build
# pytest
pip-tools==7.3.0
# via -r requirements.in
pluggy==1.3.0
# via pytest
pyproject-hooks==1.0.0
# via build
pyrsistent==0.19.3
# via jsonschema
pystac[validation]==1.8.3
# via -r requirements.in
pytest==7.4.2
# via -r requirements.in
python-dateutil==2.8.2
# via pystac
six==1.16.0
Expand Down
38 changes: 0 additions & 38 deletions scripts/validate_collections.py

This file was deleted.

13 changes: 13 additions & 0 deletions tests/test_collections.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from pathlib import Path

import pytest
from pystac import Collection

ROOT = Path(__file__).parents[1]
COLLECTIONS_PATH = ROOT / "ingestion-data" / "collections"


@pytest.mark.parametrize("path", COLLECTIONS_PATH.rglob("*.json"))
def test_validate(path: Path) -> None:
collection = Collection.from_file(str(path))
collection.validate()

0 comments on commit 66b8a6a

Please sign in to comment.