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

Omit project_euler/ from coverage reports #10469

Merged
merged 2 commits into from
Oct 15, 2023
Merged

Omit project_euler/ from coverage reports #10469

merged 2 commits into from
Oct 15, 2023

Conversation

tianyizheng02
Copy link
Contributor

Describe your change:

Our current pytest command for our builds is the following:

pytest --ignore=quantum/q_fourier_transform.py --ignore=project_euler/ --ignore=scripts/validate_solutions.py --cov-report=term-missing:skip-covered --cov=. .

Since we're not testing files in the project_euler/ or scripts/ directories, we should exclude them from our builds' coverage reports as well. project_euler/ files in particular significantly clutter the reports.

  • Add an algorithm?
  • Fix a bug or typo in an existing algorithm?
  • Documentation change?

Checklist:

  • I have read CONTRIBUTING.md.
  • This pull request is all my own work -- I have not plagiarized.
  • I know that pull requests will not be merged if they fail the automated tests.
  • This PR only changes one algorithm file. To ease review, please open separate PRs for separate algorithms.
  • All new Python files are placed inside an existing directory.
  • All filenames are in all lowercase characters with no spaces or dashes.
  • All functions and variable names follow Python naming conventions.
  • All function parameters and return values are annotated with Python type hints.
  • All functions have doctests that pass the automated testing.
  • All new algorithms include at least one URL that points to Wikipedia or another similar explanation.
  • If this pull request resolves one or more open issues then the description above includes the issue number(s) with a closing keyword: "Fixes #ISSUE-NUMBER".

@algorithms-keeper algorithms-keeper bot added enhancement This PR modified some existing files awaiting reviews This PR is ready to be reviewed labels Oct 14, 2023
@tianyizheng02 tianyizheng02 requested a review from cclauss October 14, 2023 20:25
pyproject.toml Outdated
omit = [
".env/*",
"project_euler/*",
"scripts/*"
Copy link
Member

Choose a reason for hiding this comment

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

Let's leave scripts in. I dislike not testing things.

Suggested change
"scripts/*"

I think the coverage report is way too long and users need to scroll across hundreds of lines (that no one reads) to find their failing pytests.

Would it be possible to put coverage in a separate GitHub Actions step so its output is not tagged directly on the end of pytest output?

Copy link
Contributor Author

@tianyizheng02 tianyizheng02 Oct 14, 2023

Choose a reason for hiding this comment

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

We could break up pytest into two separate workflows, one for tests and one for coverage.

Current:

- name: Run tests
        # TODO: #8818 Re-enable quantum tests
        run: pytest
            --ignore=quantum/q_fourier_transform.py
            --ignore=project_euler/
            --ignore=scripts/validate_solutions.py
            --cov-report=term-missing:skip-covered
            --cov=. .

Proposed:

- name: Run tests
        # TODO: #8818 Re-enable quantum tests
        run: pytest
            --ignore=quantum/q_fourier_transform.py
            --ignore=project_euler/
            --ignore=scripts/validate_solutions.py
- name: Check test coverage
        run: pytest
            --cov-report=term-missing:skip-covered
            --cov=.

If this looks good to you, I can make this change in a separate PR.

@tianyizheng02 tianyizheng02 requested a review from cclauss October 15, 2023 15:08
@cclauss cclauss changed the title Omit project_euler/ and scripts/ from coverage reports Omit project_euler/ from coverage reports Oct 15, 2023
@algorithms-keeper algorithms-keeper bot removed the awaiting reviews This PR is ready to be reviewed label Oct 15, 2023
@cclauss cclauss merged commit 755659a into master Oct 15, 2023
@cclauss cclauss deleted the cov-report branch October 15, 2023 15:17
sedatguzelsemme pushed a commit to sedatguzelsemme/Python that referenced this pull request Sep 15, 2024
* Omit project_euler/ and scripts/ from coverage reports

* Add scripts/ back into coverage reports
@isidroas isidroas mentioned this pull request Jan 25, 2025
14 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement This PR modified some existing files
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants