Skip to content

Commit

Permalink
fixup! Refactor process test example parsing/listing to openeo_test_s…
Browse files Browse the repository at this point in the history
…uite.lib.processes.registry
  • Loading branch information
soxofaan committed Jan 23, 2024
1 parent 7e4c1ed commit 488e9bf
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/internal-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,4 @@ jobs:
python -m pip install --upgrade pip
python -m pip install .
- name: "Internal tests"
run: |
export OPENEO_TEST_SUITE_PROCESSES_TEST_ROOT=assets/processes/tests
pytest src/openeo_test_suite/lib/internal-tests/
run: pytest src/openeo_test_suite/lib/internal-tests/
2 changes: 2 additions & 0 deletions .github/workflows/pytest-collect.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ jobs:
steps:
- name: Clone repo
uses: actions/checkout@v2
with:
submodules: recursive
- name: Set up python
uses: actions/setup-python@v4
with:
Expand Down
20 changes: 17 additions & 3 deletions src/openeo_test_suite/lib/processes/registry.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,24 @@ def __init__(self, root: Optional[Path] = None):
"""
self._root = Path(
root
# TODO: eliminate need for this env var
# TODO: eliminate need for this env var?
or os.environ.get("OPENEO_TEST_SUITE_PROCESSES_TEST_ROOT")
# TODO: make this default path compatible with packaging
or (Path(openeo_test_suite.__file__).parents[2] / "assets/processes/tests")
or self._guess_root()
)

def _guess_root(self):
# TODO: avoid need for guessing and properly include assets in (installed) package
project_root = Path(openeo_test_suite.__file__).parents[2]
candidates = [
project_root / "assets/processes/tests",
Path("./assets/processes/tests"),
Path("./openeo-test-suite/assets/processes/tests"),
]
for candidate in candidates:
if candidate.exists() and candidate.is_dir():
return candidate
raise ValueError(
f"Could not find valid processes test root directory (tried {candidates})"
)

def get_all_processes(self) -> Iterator[ProcessData]:
Expand Down

0 comments on commit 488e9bf

Please sign in to comment.