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

Conversation

ps2181
Copy link
Contributor

@ps2181 ps2181 commented Dec 19, 2024

@reyammer , as per your review comment on PR #792, I have added Coverage Analysis for Tests of Python Package for issue #221 and updated pytest configurations. Kindly review the code and verify if the changes align with the requisite updates.

The following changes have been made:
Implemented coverage analysis for the Python package using pytest-cov.
Configured pytest.ini to include coverage settings.
Added coverage tracking to the CI/CD workflow.
Updated .github/workflows to upload coverage reports to Coveralls for better visibility and reporting.

Closes #221.

uv run --python ${{ matrix.python-version }} pytest tests -m "not slow" --cov=src/magika --cov-report=xml --cov-report=term

- 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

@reyammer
Copy link
Collaborator

Thanks! Added @kralka as reviewer to double check.

@reyammer reyammer requested a review from kralka December 20, 2024 09:25
@@ -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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add coverage analysis for tests of the python package
3 participants