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

Branch coverage on continue statement #368

Closed
ludaavics opened this issue Nov 26, 2019 · 1 comment
Closed

Branch coverage on continue statement #368

ludaavics opened this issue Nov 26, 2019 · 1 comment

Comments

@ludaavics
Copy link

Not sure if this is a feature or a bug, but the following snippet reports 3->5 as missing coverage ...

def my_func(x):
    for i in range(10):
        if i > 3:
            print("Doing some work")
        continue


# in the test suite
import foo

def test_foo():
    bar = foo.my_func(5)

... while the following code gives 100% branch test coverage

def my_func(x):
    for i in range(10):
        if i > 3:
            print("Doing some work")
        print("Doing nothing")
        continue

I realize the example above is a bit contrived, since there is nothing after the continue, but seems like the first snippet should have full test coverage?

It seems there is something about the no-op statements, since the following also report missing coverage:

def my_func(x):
    for i in range(10):
        if i > 3:
            print("Doing some work")
        pass
@nedbat
Copy link
Collaborator

nedbat commented Nov 26, 2019

This is because of coverage.py bug nedbat/coveragepy#198, which is really a Python issue. There's nothing pytest-cov can do about it.

AddahDraggon added a commit to wleklinskimateusz/aMAZEd that referenced this issue Feb 7, 2025
AddahDraggon added a commit to wleklinskimateusz/aMAZEd that referenced this issue Feb 10, 2025
* Added maze sizes and test for that

* Added grid transformer class

* Fixed reversing the original grid instead of a copy in __debug_print__

* Made maze.size() return 0,0 when empty and Grid react properly to it (aka not at all)

* Added tests

* Fixing test coverage bug from pytest-dev/pytest-cov#368

* Fixed MyPy complaining about not having proper type
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

No branches or pull requests

2 participants