Closed gilcu2 closed 11 months ago
TCP server on trio running from a fixture:
@pytest.fixture(scope="session") def server() -> Generator: server_proc = subprocess.Popen( [ sys.executable, "src/server.py", ], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, ) time.sleep(0.1) assert not server_proc.poll() assert "TCP listening on 1234" in server_proc.stdout.read().decode("utf-8") # type: ignore yield server_proc server_proc.terminate()
The sync lines of server.py get coverage but the async no. I have tried several combination like:
but don't get the coverage
Async lines covered. I know they run because I have log feedback
python = "^3.11" anyio = { extras = ["trio"], version = "^4.0.0" } pytest = "^7.4.0" pytest-cov = "^4.1.0"
[tool.coverage.run]
sigterm = "true"
I think a more complete reproducer is required here.
Hi sorry. Was my fault. The server under pytest was not running because the same server was running alone in the same port.
Summary
TCP server on trio running from a fixture:
The sync lines of server.py get coverage but the async no. I have tried several combination like:
but don't get the coverage
Expected vs actual result
Async lines covered. I know they run because I have log feedback
Reproducer
Versions
python = "^3.11" anyio = { extras = ["trio"], version = "^4.0.0" } pytest = "^7.4.0" pytest-cov = "^4.1.0"
Config
[tool.coverage.run]
concurrency = ["greenlet"]
concurrency = ["thread","gevent"]
concurrency = ["greenlet", "thread"]
sigterm = "true"