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

avoid raising DCO010 for overloads #21

Closed
wants to merge 3 commits into from
Closed

avoid raising DCO010 for overloads #21

wants to merge 3 commits into from

Conversation

vpoulailleau
Copy link

closes #20

jdkandersson
jdkandersson previously approved these changes Nov 28, 2023
@jdkandersson
Copy link
Owner

Thanks for submitting this, it looks like there are some code coverage issues. Once resolved please I'm happy to merge this

@vpoulailleau
Copy link
Author

@jdkandersson This is strange: the line 326 in flake8_docstrings_complete/__init__.py is said not being covered. Though this is the line that calls the detection of @overload. If I replace the not covered return True by a not covered return False, then the two tests that I added are failing… And the line is still marked as not covered…

@vpoulailleau
Copy link
Author

I start to see the point. pytest-cov and coverage don't report the same thing! I'm used to pytest-cov (100% coverage and branch coverage) whereas coverage reports missing branch coverage… (being more precise on condition combinations.

@vpoulailleau
Copy link
Author

vpoulailleau commented Nov 28, 2023

@jdkandersson This is very strange…

When I run

python -m pytest -v --tb native -s --cov=flake8_docstrings_complete --cov=tests --cov-branch
python -m coverage report

I get:

Name                                      Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------
flake8_docstrings_complete/__init__.py      157      0     56      0   100%
flake8_docstrings_complete/args.py           46      0     30      0   100%
flake8_docstrings_complete/attrs.py         120      0     65      0   100%
flake8_docstrings_complete/constants.py       2      0      0      0   100%
flake8_docstrings_complete/docstring.py      45      0     12      0   100%
flake8_docstrings_complete/raises.py         51      0     36      0   100%
flake8_docstrings_complete/types_.py         15      0      0      0   100%
tests/__init__.py                             0      0      0      0   100%
tests/integration/__init__.py                 0      0      0      0   100%
tests/integration/test___init__.py           51      0     12      0   100%
tests/test_docstring.py                      13      0      4      0   100%
tests/unit/__init__.py                        0      0      0      0   100%
tests/unit/result.py                          7      0      2      0   100%
tests/unit/test___init__.py                  10      0      4      0   100%
tests/unit/test___init__args.py               7      0      2      0   100%
tests/unit/test___init__attrs.py              8      0      2      0   100%
tests/unit/test___init__raises.py             7      0      2      0   100%
-------------------------------------------------------------------------------------
TOTAL                                       539      0    227      0   100%

But when I run:

python -m coverage run -m pytest -v --tb native -s  # or with an extra --cov-branch
python -m coverage report

I get:

Name                                      Stmts   Miss Branch BrPart  Cover   Missing
-------------------------------------------------------------------------------------
flake8_docstrings_complete/__init__.py      157      1     56      1    99%   326
flake8_docstrings_complete/args.py           46      0     30      0   100%
flake8_docstrings_complete/attrs.py         120      3     65      1    98%   90-92
flake8_docstrings_complete/constants.py       2      0      0      0   100%
flake8_docstrings_complete/docstring.py      45      0     12      0   100%
flake8_docstrings_complete/raises.py         51      0     36      0   100%
flake8_docstrings_complete/types_.py         15      0      0      0   100%
tests/__init__.py                             0      0      0      0   100%
tests/integration/__init__.py                 0      0      0      0   100%
tests/integration/test___init__.py           51      0     12      0   100%
tests/test_docstring.py                      13      0      4      0   100%
tests/unit/__init__.py                        0      0      0      0   100%
tests/unit/result.py                          7      0      2      0   100%
tests/unit/test___init__.py                  10      0      4      0   100%
tests/unit/test___init__args.py               7      0      2      0   100%
tests/unit/test___init__attrs.py              8      0      2      0   100%
tests/unit/test___init__raises.py             7      0      2      0   100%
-------------------------------------------------------------------------------------
TOTAL                                       539      4    227      2    99%
Coverage failure: total of 99 is less than fail-under=100

Any idea why the branch coverage report is different with the same test suite?

@jdkandersson
Copy link
Owner

jdkandersson commented Nov 29, 2023

I created a PR for this, please confirm that it addresses the feature request: #22

I realised that a few pieces of logic were in the wrong place. Not sure what is going on with the coverage checking. I recommend using the tox -e test-flake86 command which will run the tests in the same way as in CI.

@vpoulailleau
Copy link
Author

Superseded by #22

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.

Avoid raising DCO010 (missing docstring) for overloads
2 participants