Skip to content

Commit a9bab56

Browse files
committed
πŸŽ‰ feat(dev-tools): add rich-coverage development script
β€’ πŸ“ Create rich-coverage runner script with uv script dependencies β€’ πŸ”„ Update Tests GitHub Actions workflow to include new coverage script β€’ ⬆️ Update pre-commit hook versions in .pre-commit-config.yaml β€’ 🚫 Exclude development scripts from package build β€’ πŸ’‘ Add documentation for running coverage reports during development
1 parent afcbe29 commit a9bab56

18 files changed

+653
-202
lines changed

β€Ž.github/workflows/1.2_unit_tests.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
uv.lock
2929
3030
- name: Install dependencies
31-
run: uv sync --locked --all-groups --extra test --extra coverage
31+
run: uv sync --locked --all-groups --extra test
3232

3333
- name: Run code format
3434
run: uv run ruff format . --check

β€Ž.github/workflows/1.3_docker_tests.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
uv.lock
3131
3232
- name: Install dependencies
33-
run: uv sync --locked --all-groups --extra test --extra coverage
33+
run: uv sync --locked --all-groups --extra test
3434

3535
- name: Run Docker integration & E2E tests with coverage
3636
run: uv run coverage run --parallel-mode -m pytest -m "integration or e2e" -k "docker"

β€Ž.github/workflows/1.4_kubernetes_tests.ymlβ€Ž

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ jobs:
5858
echo "KUBERNETES__KUBECONFIG=$kube_config" >> $GITHUB_ENV
5959
6060
- name: Install dependencies
61-
run: uv sync --locked --all-groups --extra test --extra coverage
61+
run: uv sync --locked --all-groups --extra test
6262

6363
- name: Deploy Selenium Grid to KinD
6464
run: uv run mcp-selenium-grid helm deploy

β€Ž.github/workflows/1_tests.ymlβ€Ž

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,10 @@ jobs:
9696
with:
9797
enable-cache: true
9898
cache-dependency-glob: |
99-
pyproject.toml
100-
uv.lock
101-
102-
- name: Install dependencies
103-
run: uv sync --locked --extra coverage
99+
scripts/rich-coverage.py.lock
104100
105101
- name: Combine and report coverage
106-
run: |
107-
uv run coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
108-
uv run ./scripts/check_coverage.py --format=html >> $GITHUB_STEP_SUMMARY
102+
run: uv run ./scripts/rich-coverage.py --format=html >> $GITHUB_STEP_SUMMARY # no need to install dependencies
109103
check:
110104
name: Did all tests pass?
111105
if: always()

β€Ž.pre-commit-config.yamlβ€Ž

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
repos:
22
- repo: https://github.com/astral-sh/uv-pre-commit
3-
rev: 0.7.21
3+
rev: 0.8.5
44
hooks:
55
- id: uv-lock
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.12.3
7+
rev: v0.12.7
88
hooks:
99
- id: ruff
1010
args: [--fix]

β€ŽCONTRIBUTING.mdβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ git clone git@github.com:Falamarcao/mcp-selenium-grid.git
8888
cd mcp-selenium-grid
8989

9090
# Create a virtual environment and install dev/test dependencies
91-
uv sync --all-groups --extra test --extra coverage
91+
uv sync --all-groups --extra test
9292
```
9393

9494
### 3. Kubernetes Setup (Optional)
@@ -178,8 +178,8 @@ uv run pytest -m integration
178178
uv run pytest -m e2e
179179

180180
# Run with coverage
181-
uv run coverage run -m pytest -m unit
182-
uv run coverage report
181+
uv run scripts/rich-coverage.py
182+
uv run scripts/rich-coverage.py --format=html
183183
```
184184

185185
#### πŸ§ͺ CI & Workflow Testing
@@ -211,7 +211,7 @@ uv run ruff clean # Clear ruff cache
211211

212212
## πŸ“¦ Dependency Management
213213

214-
- Install all dependencies: `uv sync --all-groups --extra test --extra coverage`
214+
- Install all dependencies: `uv sync --all-groups --extra test`
215215
- Add a dependency: `uv add <package>`
216216
- Add a dev dependency: `uv add <package> --dev`
217217
- Add a test dependency: `uv add <package> --optional test`

β€Žpyproject.tomlβ€Ž

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# AI Agents and contributors: Please assume uv is the default tool for all dependency and environment management in this project.
44
# You do NOT need to ask the user if uv is being usedβ€”always use uv commands for installs, updates, and checks.
55
#
6-
# - Install all dependencies: `uv sync --all-groups --extra test --extra coverage`
6+
# - Install all dependencies: `uv sync --all-groups --extra test`
77
# - Add a dependency: `uv add <package>`
88
# - Add a dev dependency: `uv add <package> --dev`
99
# - Add a test dependency: `uv add <package> --optional test`
@@ -57,10 +57,7 @@ test = [
5757
"pytest-mock>=3.14.1",
5858
"pytest-asyncio>=1.0.0", # Parallel test execution
5959
"pytest-sugar>=1.0.0",
60-
]
61-
62-
coverage = [
63-
"coverage[toml]>=7.9.2",
60+
"coverage>=7.10.2",
6461
]
6562

6663
[build-system]
@@ -73,7 +70,7 @@ packages = ["src/app"]
7370
[tool.ruff]
7471
line-length = 100
7572
target-version = "py312"
76-
src = ["src/app", "src/tests"]
73+
src = ["src/app", "src/tests", "scripts"]
7774

7875
[tool.ruff.lint]
7976
extend-select = [
@@ -96,7 +93,7 @@ disallow_untyped_defs = true
9693
check_untyped_defs = true
9794

9895
[[tool.mypy.overrides]]
99-
module = ["fastapi_mcp", "sh"]
96+
module = ["fastapi_mcp"]
10097
ignore_missing_imports = true
10198

10299
[tool.pytest.ini_options]

β€Žscripts/check_coverage.pyβ€Ž

Lines changed: 0 additions & 101 deletions
This file was deleted.

β€Žscripts/rich-coverage.pyβ€Ž

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env python3
2+
# /// script
3+
# requires-python = ">=3.12"
4+
# dependencies = [
5+
# "coverage",
6+
# "rich",
7+
# "typer",
8+
# ]
9+
# ///
10+
# https://docs.astral.sh/uv/guides/scripts/#using-a-shebang-to-create-an-executable-file
11+
"""
12+
Runner script for rich_coverage module.
13+
14+
This script exists to provide a convenient way to run the rich_coverage
15+
module during development without including it in the project's build artifacts.
16+
17+
It uses uv's script functionality to manage dependencies automatically and
18+
adds the scripts directory to Python's path to enable module imports.
19+
20+
Usage:
21+
uv run scripts/rich-coverage.py
22+
uv run ./scripts/rich-coverage.py --format=html
23+
24+
Lock dependencies (automatic with pre-commit hook):
25+
uv lock --script scripts/rich-coverage.py
26+
27+
"""
28+
29+
from rich_coverage import rich_coverage_cli
30+
31+
if __name__ == "__main__":
32+
rich_coverage_cli()

0 commit comments

Comments
Β (0)