diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7b8257a..5dfe3ed 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,8 +28,8 @@ jobs: # works without a Flower install. run: | python -m pip install --upgrade pip - pip install pytest "rocrate>=0.13" "tomli>=2.0; python_version < '3.11'" + pip install pytest pytest-cov "rocrate>=0.13" "tomli>=2.0; python_version < '3.11'" pip install -e . --no-deps - - name: Run tests - run: pytest -q + - name: Run tests with coverage + run: pytest -q --cov=flwrcrate --cov-report=term-missing --cov-fail-under=85 diff --git a/.gitignore b/.gitignore index 069a5b7..3d22253 100644 --- a/.gitignore +++ b/.gitignore @@ -10,5 +10,11 @@ dist/ fl_crate_out/ *.tmp +# Test / coverage artifacts +.coverage +.coverage.* +.pytest_cache/ +htmlcov/ + # macOS .DS_Store diff --git a/README.md b/README.md index 20b37c9..f4bd085 100644 --- a/README.md +++ b/README.md @@ -259,15 +259,17 @@ it produced. ## Development ```bash -pip install -e ".[dev]" # installs pytest -pytest # run the full unit + integration suite +pip install -e ".[dev]" # installs pytest + pytest-cov +pytest # run the full unit + integration suite +pytest --cov=flwrcrate --cov-report=term-missing # with a coverage report ``` The suite is split into fast **unit** tests (dependency parsing, metric handling, slug/person helpers, crate assembly) and **integration** tests that drive the whole `FLCrateTracker` lifecycle and assert a complete, correct `ro-crate-metadata.json` — without needing Flower, Ray, or any ML framework -installed. CI runs it on Python 3.10–3.12 (see the badge above). +installed. CI runs it on Python 3.10–3.12 (see the badge above) and enforces a +minimum coverage of 85% (currently ~92%). ## License diff --git a/pyproject.toml b/pyproject.toml index 92a4411..f2fd4ea 100755 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,10 +16,13 @@ dependencies = [ ] [project.optional-dependencies] -dev = ["pytest>=7.0"] +dev = ["pytest>=7.0", "pytest-cov>=4.0"] [tool.hatch.build.targets.wheel] packages = ["flwrcrate"] [tool.pytest.ini_options] testpaths = ["tests"] + +[tool.coverage.run] +source = ["flwrcrate"]