Skip to content

Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.

ci: measure coverage by source directory, not package name (#104)

A. Sam Mohammad524be811680d
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 8a9aa66..11387e4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -99,12 +99,14 @@ jobs:
working-directory: packages/mcp-server-revit
run: uv lock --check
+ # Run from the package directory: [tool.coverage.run] source is a relative path.
- name: Run Python tests with coverage
+ working-directory: packages/mcp-server-revit
run: |
mkdir -p "$REPORTS_DIR"
- python -m pytest packages/mcp-server-revit/tests \
+ python -m pytest tests \
--junitxml="$REPORTS_DIR/junit.xml" \
- --cov --cov-config=packages/mcp-server-revit/pyproject.toml \
+ --cov --cov-config=pyproject.toml \
--cov-report=term \
--cov-report="xml:$REPORTS_DIR/coverage.xml"
diff --git a/packages/mcp-server-revit/pyproject.toml b/packages/mcp-server-revit/pyproject.toml
index 2fd66b5..a4942cb 100644
--- a/packages/mcp-server-revit/pyproject.toml
+++ b/packages/mcp-server-revit/pyproject.toml
@@ -100,9 +100,19 @@ filterwarnings = [
[tool.coverage.run]
branch = true
-source_pkgs = ["revit_mcp_server"]
+# Measure by directory, not package name: several tests load modules by file path
+# (importlib.util.spec_from_file_location), which source_pkgs would report at 0%.
+source = ["src/revit_mcp_server"]
+relative_files = true
omit = ["*/tests/*", "*/_version.py"]
+[tool.coverage.paths]
+# An installed (site-packages) copy and the src tree are the same code.
+source = [
+ "src/revit_mcp_server",
+ "*/site-packages/revit_mcp_server",
+]
+
[tool.coverage.report]
# Measured at 59% (line + branch) when this gate was introduced; the floor sits a
# few points below so noise does not break CI but a real drop does.