code coverage reproduction

Reproduction for django/channels#2063 and nedbat/coveragepy#1718.

I tried also adding different concurrency options in .coveragerc but was unable to find a setup that made coverage get collected.

Reproduction

Create a virtualenv

pyenv virtualenv 3.10 coverage_repro_small
pyenv activate coverage_repro_small

Install dependencies

pip install requirements.txt
playwright install
playwright install-deps chromium

Run tests - Live server test case:

sh coverage-live.sh
open htmlcov/index.html
# If you navigate to `coverage_repro_small/views.py`, you should see 100% coverage.
image

Run tests - Channels server test case:

sh coverage-channels.sh
open htmlcov/index.html
# If you navigate to `coverage_repro_small/views.py`, you should see 50% coverage.
image

Misc

python manage.py runserver 8080