From 91eb474dc0f8c8cbbc52603391f07abbde34737a Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 16 Sep 2026 02:55:49 +0200 Subject: [PATCH] chore: move test tooling under tests --- Jenkinsfile | 2 +- docs/development.md | 6 +++--- docs/diagnostic-contract.md | 4 ++-- docs/standalone.md | 2 +- requirements.txt => tests/requirements.txt | 2 +- tests/support_validation.py | 2 +- test.sh => tests/test.sh | 4 ++-- 7 files changed, 11 insertions(+), 11 deletions(-) rename requirements.txt => tests/requirements.txt (89%) rename test.sh => tests/test.sh (59%) diff --git a/Jenkinsfile b/Jenkinsfile index 679e812..c6ad475 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -12,7 +12,7 @@ pipeline { } stage('Test') { - steps { sh './test.sh' } + steps { sh './tests/test.sh' } } } diff --git a/docs/development.md b/docs/development.md index fedbfe0..de0d01a 100644 --- a/docs/development.md +++ b/docs/development.md @@ -6,10 +6,10 @@ is documented in the main [README](../README.md). ## Test environment Tests require uv. `test.sh` creates `.venv` and synchronizes the pinned packages -from `requirements.txt`, and invokes Python only from that environment. +from `tests/requirements.txt`, and invokes Python only from that environment. ```bash -./test.sh +./tests/test.sh ``` The suite covers diagnostic contract validation, evidence hashes and JSON @@ -29,7 +29,7 @@ When changing a rule: 1. Add or update a sanitized fixture that exercises the behavior. 2. Verify finding identity, severity, confidence, and evidence references. 3. Confirm incomplete collection cannot imply a healthy result. -4. Run `./test.sh` and `git diff --check`. +4. Run `./tests/test.sh` and `git diff --check`. ## Contract changes diff --git a/docs/diagnostic-contract.md b/docs/diagnostic-contract.md index afd9c6a..82910d2 100644 --- a/docs/diagnostic-contract.md +++ b/docs/diagnostic-contract.md @@ -11,11 +11,11 @@ Bash and Typst 0.15 or newer are required at runtime. From a standalone componen ```bash bash tools/validate.sh examples/diagnostic.json bash tools/validate.sh examples/diagnostic.json --evidence-root tests/fixtures/legacy -./test.sh +./tests/test.sh ``` The test target creates a uv-managed Python environment and synchronizes the -pinned test dependencies from `requirements.txt`. +pinned test dependencies from `tests/requirements.txt`. No Typst, Reportist, macro checkout, network service, or live Windows machine is needed after dependencies are installed. Validation accepts an explicit JSON path, writes no artifacts, and exits 0 for valid input, 1 for invalid/unreadable input or diff --git a/docs/standalone.md b/docs/standalone.md index 56511cd..fc64e53 100644 --- a/docs/standalone.md +++ b/docs/standalone.md @@ -8,7 +8,7 @@ beffroi-reports, the integration workspace, and legacy sources are not runtime dependencies. ```bash -./test.sh +./tests/test.sh ``` ```bash diff --git a/requirements.txt b/tests/requirements.txt similarity index 89% rename from requirements.txt rename to tests/requirements.txt index cfc388e..d9b32c1 100644 --- a/requirements.txt +++ b/tests/requirements.txt @@ -1,5 +1,5 @@ # Pinned dependencies for the Python test oracle. -# Update versions here intentionally, then run ./test.sh. +# Update versions here intentionally, then run ./tests/test.sh. attrs==26.1.0 # via # jsonschema diff --git a/tests/support_validation.py b/tests/support_validation.py index 50477cb..b20e5d5 100644 --- a/tests/support_validation.py +++ b/tests/support_validation.py @@ -11,7 +11,7 @@ try: import rfc3339_validator # Required so date-time formats cannot be silently ignored. from jsonschema import Draft202012Validator, FormatChecker except ImportError: - raise SystemExit("Prepare test dependencies with: ./test.sh") + raise SystemExit("Prepare test dependencies with: ./tests/test.sh") SCHEMA = json.loads((Path(__file__).resolve().parents[1] / "schemas/diagnostic.schema.json").read_text()) Draft202012Validator.check_schema(SCHEMA) diff --git a/test.sh b/tests/test.sh similarity index 59% rename from test.sh rename to tests/test.sh index eff8349..7438c7a 100755 --- a/test.sh +++ b/tests/test.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set -euo pipefail -cd "$(dirname "${BASH_SOURCE[0]}")" +cd "$(dirname "${BASH_SOURCE[0]}")/.." uv venv --python 3.11 --allow-existing .venv -uv pip sync --python .venv/bin/python requirements.txt +uv pip sync --python .venv/bin/python tests/requirements.txt .venv/bin/python -m unittest discover -s tests -p 'test_*.py' -v