Commit 9767317
committed
docs: Convert async_programming.md to executable doctests
Removed all 12 # doctest: +SKIP markers and converted to executable
doctests using CPython asyncio.run() pattern. All examples now use
server fixture for TestServer isolation and assert behavior (True/False).
Changes:
- Pattern A basic: Uses server.acmd() with behavioral assertions
- Creating sessions concurrently: 3 sessions with cleanup and validation
- Managing windows: Creates/configures 3 windows, sends commands
- Pattern B basic: Uses tmux_cmd_async with socket isolation
- Concurrent execution: Gathers 4 commands with error handling
- Error handling: Checks returncode and creates session on demand
- Benchmarking: Measures async vs sync with 10% variance allowance
- Safe command: Returns None for non-existent sessions
- Resource cleanup: Uses try/finally pattern with cleanup
- Session management: Creates 2 sessions with windows concurrently
- Health monitoring: Checks session status (alive/dead/error)
- Bulk operations: Sends commands to all panes in session
All examples use server.socket_name for isolation, include cleanup,
and return boolean assertions for deterministic test results.
Verified with: pytest docs/topics/async_programming.md --doctest-modules -v
Result: 12 passed in 1.03s1 parent 1425db3 commit 9767317
1 file changed
+106
-99
lines changed
0 commit comments