From 1553a00f397fa8c0498d2830b6befa5ab097b8b3 Mon Sep 17 00:00:00 2001 From: Thomas Schmelzer Date: Tue, 28 Jul 2026 12:58:04 +0400 Subject: [PATCH] docs: add docstrings to nested test helpers Rhiza v1.2.2 widens the docs-coverage gate from ${SOURCE_FOLDER} to "src tests .rhiza/tests", so helper classes and functions defined inside test bodies are now scanned by interrogate --fail-under 100. Documents the eight that were missing: - _Event and its is_set/wait (test_interface.py) - _InterruptingEvent and its is_set/wait (test_interface.py) - _healthy x2 (test_lifecycle.py) Tests-only change; no src/ or behaviour is touched. Closes #64 Co-Authored-By: Claude Opus 5 (1M context) --- tests/pycharting/api/test_interface.py | 8 ++++++++ tests/pycharting/core/test_lifecycle.py | 2 ++ 2 files changed, 10 insertions(+) diff --git a/tests/pycharting/api/test_interface.py b/tests/pycharting/api/test_interface.py index 25445ce..6923231 100644 --- a/tests/pycharting/api/test_interface.py +++ b/tests/pycharting/api/test_interface.py @@ -161,14 +161,18 @@ def test_plot_block_returns_when_shutdown_event_set(): """ class _Event: + """Fake shutdown event that reports "not set" once, then "set".""" + def __init__(self): self._checks = 0 def is_set(self): + """Return False on the first call, then True, yielding one loop iteration.""" self._checks += 1 return self._checks > 1 # False first, then True -> exactly one iteration def wait(self, timeout=None): + """Return immediately — the wait duration is irrelevant to this test.""" return None n = 10 @@ -189,10 +193,14 @@ def test_plot_block_handles_keyboard_interrupt(): """A Ctrl+C during the blocking wait stops the server and still returns success.""" class _InterruptingEvent: + """Fake shutdown event whose wait raises ``KeyboardInterrupt``.""" + def is_set(self): + """Report the event as never set, so ``plot()`` enters the blocking wait.""" return False def wait(self, timeout=None): + """Simulate a Ctrl+C arriving while the caller is blocked.""" raise KeyboardInterrupt n = 10 diff --git a/tests/pycharting/core/test_lifecycle.py b/tests/pycharting/core/test_lifecycle.py index ec72317..a73c8ab 100644 --- a/tests/pycharting/core/test_lifecycle.py +++ b/tests/pycharting/core/test_lifecycle.py @@ -282,6 +282,7 @@ def test_server_responds_after_start(wait_until): server = ChartServer() def _healthy(): + """Return the health response once it comes back 200, else None to retry.""" try: response = httpx.get(f"http://{server.host}:{server.port}/health", timeout=1) except httpx.HTTPError: @@ -303,6 +304,7 @@ def test_server_accessible_in_background(wait_until): server = ChartServer() def _healthy(): + """Return the health response once it comes back 200, else None to retry.""" try: response = httpx.get(f"http://{server.host}:{server.port}/health", timeout=1) except httpx.HTTPError: