Skip to content

Wrong coverage when using SQLAlchemy+asyncpg+strawberry-graphql #1216

Open
@Apakottur

Description

@Apakottur

Describe the bug

We are using the (awesome!!) coverage script in our projects and recently we've been getting some incorrect results.

The coverage script shows some code as uncovered even though it's being executed.

To Reproduce
The problem only seems to occur when multiple complex libraries are used together. Here's a minimal example that reproduces the problem:

https://gist.github.com/Apakottur/cc0b0ae6bd982dd1c2f48880ce8d9749

We use docker to fix the package versions, so to run the example one needs docker and docker-compose installed.

With all these files in the same directory, running docker-compose up --build test gives us:

test_1           | This is not covered
test_1           | Name         Stmts   Miss  Cover   Missing
test_1           | ------------------------------------------
test_1           | example.py      20      2    90%   18-19
test_1           | ------------------------------------------
test_1           | TOTAL           20      2    90%

Which is clearly contradictory, as lines 29-30 contain the printout This is not covered, which is printed.

How would we go and debug this further? Is there a way to step through the coverage script and see why it's not considering these lines?

Metadata

Metadata

Assignees

No one assigned

    Labels

    asyncbugSomething isn't workingexoticUnusual execution environment

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions