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 18, 2023
1 parent 65ded69 commit 5295172
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 50 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,8 +19,8 @@ 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
lint:
runs-on: ubuntu-latest
steps:
Expand Down
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ black[jupyter]
pip-tools
pre-commit
pystac[validation]
pytest
ruff
35 changes: 26 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ appnope==0.1.3
asttokens==2.4.0
# via stack-data
attrs==23.1.0
# via jsonschema
# via
# jsonschema
# referencing
backcall==0.2.0
# via ipython
black[jupyter]==23.9.1
black[jupyter]==23.10.0
# via -r requirements.in
build==1.0.3
# via pip-tools
Expand All @@ -32,22 +34,27 @@ filelock==3.12.4
# via virtualenv
identify==2.5.30
# via pre-commit
iniconfig==2.0.0
# via pytest
ipython==8.16.1
# via black
jedi==0.19.1
# via ipython
jsonschema==4.17.3
jsonschema==4.19.1
# via pystac
jsonschema-specifications==2023.7.1
# via jsonschema
matplotlib-inline==0.1.6
# via ipython
mypy-extensions==1.0.0
# via black
nodeenv==1.8.0
# via pre-commit
packaging==23.1
packaging==23.2
# via
# black
# build
# pytest
parso==0.8.3
# via jedi
pathspec==0.11.2
Expand All @@ -62,7 +69,9 @@ platformdirs==3.11.0
# via
# black
# virtualenv
pre-commit==3.4.0
pluggy==1.3.0
# via pytest
pre-commit==3.5.0
# via -r requirements.in
prompt-toolkit==3.0.39
# via ipython
Expand All @@ -74,15 +83,23 @@ pygments==2.16.1
# via ipython
pyproject-hooks==1.0.0
# via build
pyrsistent==0.19.3
# via jsonschema
pystac[validation]==1.8.3
pystac[validation]==1.8.4
# via -r requirements.in
pytest==7.4.2
# via -r requirements.in
python-dateutil==2.8.2
# via pystac
pyyaml==6.0.1
# via pre-commit
ruff==0.0.292
referencing==0.30.2
# via
# jsonschema
# jsonschema-specifications
rpds-py==0.10.6
# via
# jsonschema
# referencing
ruff==0.1.0
# via -r requirements.in
six==1.16.0
# via
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 5295172

Please sign in to comment.