Skip to content

Run coverage separately #79

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,23 @@ jobs:
# - name: "Pylint Tests"
# run: "poetry run pylint infrahub_sdk/"
- name: "Unit Tests"
run: "poetry run pytest tests/unit/"
run: "poetry run pytest --cov infrahub_sdk tests/unit/"
- name: "Upload coverage to Codecov"
run: |
codecov --flags python-${{ matrix.python-version }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

# The pytest-cov plugin doesn't quite work with content that is
# auto-imported by our own infrahub pytest plugin, this workaround
# reports the missing lines
- name: "Report coverage for pytest-plugin"
if: matrix.python-version == '3.12'
run: |
source $(poetry env info --path)/bin/activate
coverage run -m pytest tests/unit/pytest_plugin
coverage report -m
coverage xml
codecov --flags python-filler-${{ matrix.python-version }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ filterwarnings = [
"ignore:Module already imported so cannot be rewritten",
"ignore:Deprecated call to",
]
addopts = "-vs --cov infrahub_sdk --cov-report term-missing --cov-report xml --dist loadscope"
addopts = "-vs --cov-report term-missing --cov-report xml --dist loadscope"

[tool.mypy]
pretty = true
Expand Down