Problem
make test reports a single uncovered line: src/pycharting/api/interface.py:285 — the else: print("ⓘ No active server to stop") branch in stop_server(). Coverage sits at 99.80% (gate is 90%) solely because of this line.
A test for the branch already exists (tests/test_interface.py:168 test_stop_server_when_not_running), but it does not cover the line reliably.
Root cause
_active_server is a module-level global. The test calls stop_server() without resetting _active_server to None first. Under pytest-xdist parallelism, another test's running mock server leaks into the global, so the if _active_server and _active_server.is_running: branch is taken instead of the else. The test has no assertion on output, so it passes either way and the else branch goes uncovered.
Proposed fix
In tests/test_interface.py::test_stop_server_when_not_running, force the global to None before the call and assert on the message, e.g.:
def test_stop_server_when_not_running(self, monkeypatch, capsys):
monkeypatch.setattr("pycharting.api.interface._active_server", None)
stop_server()
assert "No active server to stop" in capsys.readouterr().out
Acceptance criteria
Subcategory: Test coverage & depth (9 → 10). Highest-leverage fix from the Rhiza quality assessment.
Problem
make testreports a single uncovered line:src/pycharting/api/interface.py:285— theelse: print("ⓘ No active server to stop")branch instop_server(). Coverage sits at 99.80% (gate is 90%) solely because of this line.A test for the branch already exists (
tests/test_interface.py:168test_stop_server_when_not_running), but it does not cover the line reliably.Root cause
_active_serveris a module-level global. The test callsstop_server()without resetting_active_servertoNonefirst. Underpytest-xdistparallelism, another test's running mock server leaks into the global, so theif _active_server and _active_server.is_running:branch is taken instead of theelse. The test has no assertion on output, so it passes either way and theelsebranch goes uncovered.Proposed fix
In
tests/test_interface.py::test_stop_server_when_not_running, force the global toNonebefore the call and assert on the message, e.g.:Acceptance criteria
make testreportssrc/pycharting/api/interface.pyat 100% (no missing line 285) across repeated parallel runs.Subcategory: Test coverage & depth (9 → 10). Highest-leverage fix from the Rhiza quality assessment.