From 3ba7abfab8f45ed32e089580e85aa97655e387fb Mon Sep 17 00:00:00 2001 From: Steven Hartland Date: Thu, 10 Jul 2025 20:25:19 +0100 Subject: [PATCH] chore: support pytest-cov and local reporting Support pytest-cov by disabling include-ignored, allowing pytest-cov to be run, which has built in support for coverage reporting is VS Code making it super useful for checking coverage while writing tests. Related issues: - https://github.com/pytest-dev/pytest-cov/issues/532 - https://github.com/pytest-dev/pytest-cov/issues/369 Without this the coverage run will fail with an error about conflicting coverage options. Configure coverage paths so its easy to run coverage from the command line with the data downloaded from the CI run, enabling easy analysis of the coverage data. --- pyproject.toml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 162448cc56..9ba1763adb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -224,6 +224,20 @@ omit = [ "pydantic_ai_slim/pydantic_ai/ext/aci.py", # aci-sdk requires Python 3.10+ so cannot be added as an (optional) dependency ] branch = true +# Disable include-ignored warnings as --source is enabled automatically causing a self conflict as per: +# https://github.com/pytest-dev/pytest-cov/issues/532 +# https://github.com/pytest-dev/pytest-cov/issues/369 +# This prevents coverage being generated by pytest-cov which has direct editor support in VS Code, +# making it super useful to check coverage while writing tests. +disable_warnings = ["include-ignored"] + +[tool.coverage.paths] +# Allow CI run assets to be downloaded an replicated locally. +source = [ + ".", + "/home/runner/work/pydantic-ai/pydantic-ai", + "/System/Volumes/Data/home/runner/work/pydantic-ai/pydantic-ai" +] # https://coverage.readthedocs.io/en/latest/config.html#report [tool.coverage.report]