From e691654ba613d37afb3a29d8b5ab50227ceb984e Mon Sep 17 00:00:00 2001 From: yehuda arav Date: Wed, 1 Apr 2026 01:12:11 +0300 Subject: [PATCH] Add pytest configuration, CI workflow, and make test target - pytest.ini: configure test discovery (tests/ dir, -v --tb=short) - .github/workflows/tests.yml: run tests on push to master and PRs, matrix across Python 3.9/3.10/3.11/3.12 - Makefile: added 'make test' and 'make test-verbose' targets Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/tests.yml | 31 +++++++++++++++++++++++++++++++ Makefile | 13 +++++++++++++ pytest.ini | 6 ++++++ 3 files changed, 50 insertions(+) create mode 100644 .github/workflows/tests.yml create mode 100644 pytest.ini 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