diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..2ce1584 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,31 @@ +name: Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ['3.9', '3.10', '3.11', '3.12'] + + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + pip install pytest + pip install -r requirements.txt + + - name: Run tests + run: pytest diff --git a/Makefile b/Makefile index 31b76d1..b348b41 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,7 @@ PYTHON ?= python3 VENV_NAME ?= Argos .PHONY: help install install-deps install-dev env env-persist \ + test test-verbose \ mermaid-pull render-diagrams render-diagrams-force \ docs-deps docs-build docs-build-strict docs-serve docs-deploy docs-clean @@ -19,6 +20,10 @@ help: @echo " make env Print the environment variables needed for pyArgos" @echo " make env-persist Add PYTHONPATH to ~/.bashrc (prompts for confirmation)" @echo "" + @echo " Testing:" + @echo " make test Run all tests" + @echo " make test-verbose Run all tests with full output" + @echo "" @echo " Documentation:" @echo " make docs-build Build full site (render diagrams + mkdocs build)" @echo " make docs-serve Start local MkDocs preview server" @@ -96,6 +101,14 @@ env-persist: fi; \ fi +# --- Testing --- + +test: + pytest + +test-verbose: + pytest -v --tb=long + # --- Documentation --- mermaid-pull: diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..9855d94 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,6 @@ +[pytest] +testpaths = tests +python_files = test_*.py +python_classes = Test* +python_functions = test_* +addopts = -v --tb=short