diff --git a/README.md b/README.md index 66ba448..592262b 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,7 @@ viron/ │ └── services/ # Business logic ├── src/main/python/ # Python client SDK ├── src/test/java/... # Unit and integration tests + ├── src/test/python/... # Python client SDK tests (pytest) ├── db-scripts/ # SQL schema setup scripts, and migrations for existing databases ├── docs/ │ ├── MVP.md # Implementation checklist for MVP @@ -152,9 +153,21 @@ or refer to the `docs/openapi/viron-api.json` file. ## 🧪 Testing -Run all unit and integration tests: +Run all Java unit and integration tests: mvn test +Run the Python client tests (requires Python 3.8+, `requests`, and pytest 7 or newer): +pytest + +`pytest.ini` puts the repository root on the path, so the client is imported the same way +from tests as it is from application code (`src.main.python.preponderous.viron...`). The +`pythonpath` setting it uses arrived in pytest 7.0, so the pytest 6.2.4 pinned by +`requirements.txt` ignores it and collection fails; install a newer pytest until that pin is +raised. + +Note that CI runs the Java build and tests only — Python client changes are not covered there +and must be checked locally. + --- ## 📄 License diff --git a/pytest.ini b/pytest.ini index a08953c..0aea8cc 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,3 +1,5 @@ [pytest] -pythonpath = ./src/main/python - ./src/test/python \ No newline at end of file +# The client and its tests import through the full path from the repository +# root (src.main.python.preponderous.viron...), so the root is what belongs on +# the path. +pythonpath = . diff --git a/src/main/python/preponderous/viron/services/environmentService.py b/src/main/python/preponderous/viron/services/environmentService.py index 35bee0b..29cb96a 100644 --- a/src/main/python/preponderous/viron/services/environmentService.py +++ b/src/main/python/preponderous/viron/services/environmentService.py @@ -2,7 +2,7 @@ # Copyright (c) 2024 Preponderous Software # MIT License -from typing import Optional +from typing import List, Optional import requests from src.main.python.preponderous.viron.models.environment import Environment @@ -18,7 +18,7 @@ def get_base_url(self) -> str: def get_auth_headers(self) -> dict: return {"Authorization": f"Bearer {self.auth_token}"} if self.auth_token else {} - def get_all_environments(self) -> list[Environment]: + def get_all_environments(self) -> List[Environment]: response = requests.get(f"{self.get_base_url()}", headers=self.get_auth_headers()) response.raise_for_status() return [Environment(**env) for env in response.json()]