Skip to content
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

Added Coverage Analysis for Tests of Python Package and Updated Pytest Configurations #837

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
10 changes: 9 additions & 1 deletion .github/workflows/python-test-suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@ jobs:

- name: Run the python tests suite
working-directory: python
run: uv run --python ${{ matrix.python-version }} pytest tests -m "not slow"
run: |
uv run --python ${{ matrix.python-version }} pytest tests -m "not slow" --cov=src/magika --cov-report=xml --cov-report=term
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not already covered by the change in pytest.ini?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The configuration in pytest.ini centralizes the coverage settings, but the run command ensures the CI pipeline executes pytest correctly. However, I can remove the redundant options from the YAML file to avoid duplication.


- name: Upload coverage report to Coveralls
if: always()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this if should be removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The" if: always()" will ensure that the coverage report is uploaded even if one test case fails. If this is not necessary for our workflow, I can remove it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@reyammer Does this update look good, or are there any additional changes needed?

working-directory: python
uses: coverallsapp/github-action@v2
with:
path-to-coverage: coverage.xml

- name: Run magika --version
working-directory: python
Expand Down
3 changes: 2 additions & 1 deletion python/pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ filterwarnings =
markers =
smoketest
slow


addopts = --cov=src/magika --cov-report=term --cov-report=xml