Skip to content
This repository was archived by the owner on Apr 7, 2026. It is now read-only.

Commit 8801430

Browse files
committed
fix: exclude template directory from pytest collection in CI
- Added --ignore={{cookiecutter.project_slug}} to all pytest commands in CI - Updated codecov action input from 'file' to 'files' - Template directory contains Jinja2 syntax that causes pytest collection errors - Tests now pass on all platforms including macOS
1 parent 29d9cd7 commit 8801430

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

.github/workflows/test.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ jobs:
7070
pip install -e ".[dev]"
7171
7272
- name: Run fast tests
73-
run: pytest -m "not slow" -v
73+
run: pytest -m "not slow" -v --ignore={{cookiecutter.project_slug}}
7474

7575
- name: Run slow tests
76-
run: pytest -m "slow" -v
76+
run: pytest -m "slow" -v --ignore={{cookiecutter.project_slug}}
7777
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
7878

7979
test-generated-projects:
@@ -159,11 +159,11 @@ jobs:
159159
pip install -e ".[dev]"
160160
161161
- name: Run tests with coverage
162-
run: pytest --cov=. --cov-report=xml --cov-report=html
162+
run: pytest --cov=. --cov-report=xml --cov-report=html --ignore={{cookiecutter.project_slug}}
163163

164164
- name: Upload coverage to Codecov
165165
uses: codecov/codecov-action@v5
166166
with:
167-
file: ./coverage.xml
167+
files: ./coverage.xml
168168
flags: template-tests
169169
name: template-coverage

pytest.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ addopts =
1313
--cov-report=xml
1414
--durations=10
1515
--tb=short
16+
--ignore={{cookiecutter.project_slug}}
1617
testpaths = tests
1718
# Explicitly run only tests in the tests directory, exclude template directory
1819
python_files = test_*.py
1920
python_classes = Test*
2021
python_functions = test_*
2122
# Exclude template files from test collection
22-
norecursedirs = {{cookiecutter.project_slug}}
23-
ignore = {{cookiecutter.project_slug}}
23+
norecursedirs = {{cookiecutter.project_slug}} .git .pytest_cache __pycache__ *.egg-info
2424
markers =
2525
slow: marks tests as slow (deselect with '-m "not slow"')
2626
integration: marks tests as integration tests

0 commit comments

Comments
 (0)