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

Docstring at top of file effects test coverage #24179

Closed
mjbvz opened this issue Sep 24, 2024 · 5 comments
Closed

Docstring at top of file effects test coverage #24179

mjbvz opened this issue Sep 24, 2024 · 5 comments
Assignees
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@mjbvz
Copy link

mjbvz commented Sep 24, 2024

Testing #22827

For a file:

"""
A module for incrementing and decrementing numbers.
"""

def increment(x):
    """Increment x by 1, but not above 10."""
    return x + 1

The presence of the docstring at the top of the file changes coverage numbers

@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Sep 24, 2024
@eleanorjboyd
Copy link
Member

What version of python are you using?

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 25, 2024
@mjbvz
Copy link
Author

mjbvz commented Sep 25, 2024

3.12.2 with Coverage 7.6.1

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 25, 2024
@eleanorjboyd
Copy link
Member

same as another issue filed by Ben, I don't control this aspect so I think I am going to just close as out of scope

copied from #24171 (comment): huh even with the right python version I am not seeing the comments impact code coverage. Did you have any pytest arguments during this run? I think I can just close this since the decision on the code coverage percentage / numbers are dictated by coverage.py and communicated the extension so in the end we don't have control over the numbers as long as they are getting there correctly. You could always try running it in the terminal python -m pytest --cov=. to see if you get a similar result because our goal is to always mirror the tool behavior.

@eleanorjboyd eleanorjboyd closed this as not planned Won't fix, can't repro, duplicate, stale Sep 25, 2024
@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 25, 2024
@mjbvz
Copy link
Author

mjbvz commented Sep 25, 2024

Should we move this upstream to pytest?

@github-actions github-actions bot removed the info-needed Issue requires more information from poster label Sep 25, 2024
@eleanorjboyd
Copy link
Member

yes I can look into doing so for coverage. Can you confirm python -m pytest --cov=. in the terminal produces the same change and also get the versions of pytest-cov and coverage.py in your workspace? Thanks

@github-actions github-actions bot added the info-needed Issue requires more information from poster label Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants