Perfromance drop in 7.0.2 comparing to 7.0.1 · Issue #1527 · nedbat/coveragepy (original) (raw)
Describe the bug
Our test suite execution time drastically increased during update of coverage version from 7.0.1 to 7.0.2
On 7.0.1
================================= 1209 passed, 2 warnings, 106 subtests passed in 102.66s (0:01:42) =================================
On 7.0.2(3)
================================= 1209 passed, 2 warnings, 106 subtests passed in 447.32s (0:07:27) =================================
To Reproduce
Execution command
Pytest run headers (for python version, pytest plugins)
platform linux -- Python 3.11.1, pytest-7.2.0, pluggy-1.0.0
configfile: pyproject.toml, testpaths: tests
plugins: asyncio-0.20.3, subtests-0.9.0, mock-3.10.0, bdd-6.1.1, Faker-15.3.4, respx-0.20.1
asyncio: mode=Mode.AUTO
Project/test context
Project is typical fastapi/starlette + sqlalchemy, written in async/await paradigm. Most tests are typical calls to web api request and assert api response. Unfortunately cannot share source code itself, but let me know if more info needed, maybe will be able to make a "demo" mini-project.
Coverage config
[tool.coverage.run] branch = true concurrency = [ "greenlet", # for async sqlalchemy ] command_line = "-m pytest -v" dynamic_context = "test_function" source_pkgs = [ "src", ]
[tool.coverage.report] skip_empty = true exclude_lines = [ "pragma: no cover", "def repr", "if name == .main." ]
[tool.coverage.html] directory = "htmlcov" show_contexts = true
Expected behavior
There probably shouldn't be such a huge performance drawback
Additional context
Initially I thought problem is connected to python3.11 and #1287, but after downgrading first to 6.X, performance degradation was gone. Than started to upgrade version by version, until had performance issue again.
I feel that problem can be connected to refactoring made in 7.0.2, as mentioned here:
Refactor: added many type annotations, including a number of refactorings. This should not affect outward behavior, but they were a bit invasive in some places, so keep your eyes peeled for oddities.