Skip to content

Performance drop with using coverage testing starlette websocket  #1411

Open
@Randomneo

Description

@Randomneo

Describe the bug
Performance drop with using coverage testing starlette websocket.

To Reproduce
How can we reproduce the problem? Please be specific. Don't link to a failing CI job. Answer the questions below:

  1. platform linux -- Python 3.10.5, pytest-7.1.2, pluggy-1.0.0
  2. Package versions
>>> coverage.__version__
'6.4.1'
>>> fastapi.__version__
'0.78.0'
>>> starlette.__version__
'0.19.1'
  1. code: https://pastebin.com/F2iXUM4E.
  2. just running this code with pytest will in average less than 1s. But with pytest --cov or coverage run -m pytest increases its execution time 10 times (10s+ avg)

Expected behavior
Coverage do not affect execution time.

Additional context
As far as I can see problem with async to sync in starlette.testclient.TestClient and coverage.
Also coverage do not affect execution time with concurrency=greenlet (because it wont check any code that way) but execution time raises even more with concurrency=thread.greenlet

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingperformanceSomething is too slow

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions