Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ UV ?= uv
UV_PYTHON ?=
PACKAGE ?=
COVERAGE_FAIL_UNDER ?= 80
TEST_WORKERS ?= 0
TEST_ARGS ?=
RUN = $(if $(UV_PYTHON),UV_PYTHON=$(UV_PYTHON)) $(UV) run

.PHONY: all help install install-all install-dev install-test install-docs check verify diff-check lint format-check format fix type-check test test-serial test-parallel coverage build package-check package-verify docs docs-check linkcheck build-docs serve-docs hooks clean
.PHONY: all help install install-all install-dev install-test install-test-extras install-docs check verify diff-check lint format-check format fix type-check test test-serial test-parallel coverage build package-check package-verify docs docs-check linkcheck build-docs serve-docs hooks clean

help: ## Show available commands
@awk 'BEGIN {FS = ":.*## "}; /^[a-zA-Z0-9_-]+:.*## / {printf "%-18s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand All @@ -23,6 +23,9 @@ install-dev: ## Install dependencies for static checks
install-test: ## Install dependencies for tests
$(UV) sync --group test --locked $(if $(UV_PYTHON),--python $(UV_PYTHON))

install-test-extras: ## Install optional test utilities
$(UV) sync --group test --group test-extras --locked $(if $(UV_PYTHON),--python $(UV_PYTHON))

install-docs: ## Install dependencies for documentation
$(UV) sync --group docs --locked

Expand Down Expand Up @@ -51,18 +54,17 @@ fix: ## Apply Ruff lint fixes and formatting
type-check: ## Check static types with ty
$(RUN) ty check

test: ## Run tests
$(RUN) pytest -n $(TEST_WORKERS) -sv
test: ## Run tests serially
$(RUN) pytest $(TEST_ARGS)

test-serial: TEST_WORKERS = 0
test-serial: test ## Run tests without parallel workers

test-parallel: TEST_WORKERS = auto
test-parallel: test ## Run independent tests with parallel workers
test-parallel: ## Run independent tests with parallel workers
$(RUN) pytest -n auto $(TEST_ARGS)

coverage: ## Enforce coverage for PACKAGE
@test -n "$(PACKAGE)" || { echo "Set PACKAGE to the library import name."; exit 2; }
$(RUN) pytest -n $(TEST_WORKERS) --cov="$(PACKAGE)" --cov-branch --cov-report=term-missing:skip-covered --cov-fail-under="$(COVERAGE_FAIL_UNDER)" -sv
$(RUN) pytest $(TEST_ARGS) --cov="$(PACKAGE)" --cov-branch --cov-report=term-missing:skip-covered --cov-fail-under="$(COVERAGE_FAIL_UNDER)"

build: ## Build source and wheel distributions
$(UV) build --sdist --wheel
Expand Down
18 changes: 13 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,19 @@ dev = ["pre-commit", "ruff", "setuptools-scm", "ty", "vulture"]
test = [
"pytest",
"pytest-cov",
"pytest-timeout",
"pytest-xdist",
]
test-extras = [
"freezegun",
"hypothesis",
"pytest-env",
"pytest-ordering",
"pytest-randomly",
"pytest-rerunfailures",
"pytest-runner",
"pytest-sugar",
"pytest-timeout",
"pytest-vcr",
"pytest-xdist",
"freezegun",
"hypothesis",
]
docs = [
"sphinx",
Expand Down Expand Up @@ -135,10 +137,16 @@ ignore = [
docstring-code-format = true

[tool.pytest.ini_options]
addopts = ["--strict-config", "--strict-markers", "--durations=10"]
addopts = [
"--strict-config",
"--strict-markers",
"--durations=10",
"--durations-min=1.0",
]
testpaths = ["tests"]
python_files = "test_*.py"
timeout = 60
xfail_strict = true
markers = [
"unit: Unit tests",
"component: Component tests",
Expand Down
5 changes: 4 additions & 1 deletion tests/test_example.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""Test the example module."""

import pytest

def test_example(tmpdir):

@pytest.mark.unit
def test_example():
"""Test some simple math."""
assert 2 + 2 == 4
20 changes: 12 additions & 8 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading