Skip to content

Commit 00f78e6

Browse files
adamtheturtleclaude
andcommitted
Use a single **/*.rst entry in the CI matrix
Replaces the per-file rst entries with a glob. Enable bash globstar in the workflow run step so the pattern expands, and expand globs in the linter helper since pytest.main is invoked without a shell. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 9a9e460 commit 00f78e6

2 files changed

Lines changed: 21 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,7 @@ jobs:
119119
- tests/mock_vws/test_target_validators.py
120120
- tests/mock_vws/test_docker.py
121121
- ci/test_custom_linters.py
122-
- README.rst
123-
- docs/source/basic-example.rst
124-
- docs/source/httpx-example.rst
122+
- '**/*.rst'
125123

126124
steps:
127125
- uses: actions/checkout@v6
@@ -163,6 +161,7 @@ jobs:
163161

164162
- name: Run tests
165163
run: |
164+
shopt -s globstar
166165
uv run --extra=dev \
167166
coverage run -m pytest \
168167
-s \

ci/test_custom_linters.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,23 @@
77
from beartype import beartype
88

99

10+
@beartype
11+
def _expand_pattern(*, ci_pattern: str) -> list[str]:
12+
"""Expand a CI pattern, treating shell-style globs as recursive globs.
13+
14+
Hidden directories (such as ``.venv``) are skipped to match bash's
15+
default globbing behaviour. Patterns without glob metacharacters are
16+
returned unchanged.
17+
"""
18+
if not any(char in ci_pattern for char in "*?["):
19+
return [ci_pattern]
20+
return [
21+
path.as_posix()
22+
for path in Path().glob(pattern=ci_pattern)
23+
if not any(part.startswith(".") for part in path.parts)
24+
]
25+
26+
1027
@beartype
1128
def _ci_patterns(*, repository_root: Path) -> set[str]:
1229
"""Return the CI patterns given in the CI configuration file."""
@@ -52,7 +69,7 @@ def _tests_from_pattern(*, ci_pattern: str) -> set[str]:
5269
# Unknown config option: retry_delay
5370
# ```
5471
"--disable-warnings",
55-
ci_pattern,
72+
*_expand_pattern(ci_pattern=ci_pattern),
5673
],
5774
plugins=[plugin],
5875
)
@@ -71,7 +88,7 @@ def test_ci_patterns_valid(request: pytest.FixtureRequest) -> None:
7188
collect_only_result = pytest.main(
7289
args=[
7390
"--collect-only",
74-
ci_pattern,
91+
*_expand_pattern(ci_pattern=ci_pattern),
7592
# Disable pytest-retry to avoid:
7693
# ```
7794
# ValueError: no option named 'filtered_exceptions'

0 commit comments

Comments
 (0)