Add asyncio example server and tests - #45
Merged
Merged
Conversation
- example-asyncio.py: full-featured demo using telnetsrv.aio; timer command uses asyncio.create_task, passwd uses await handler.readline(), SSH served via socketserver.TCPServer + AsyncSSHHandler (each session gets its own asyncio.run() call) - example-asyncio-test.py: 52 tests covering MyServer, MyCommands (including async timer/passwd), ExampleTelnetHandler, and live integration via asyncio.start_server; added to pytest testpaths - README: document all three server flavors (threaded, green, asyncio), fix two-flavor references to three, add Longer Example descriptions - pyproject.toml: bump version to 1.0.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
example-asyncio.py: full-featured demo usingtelnetsrv.aio;timerusesasyncio.create_taskfor non-blocking delayed messages,passwdusesawait handler.readline(), SSH mode served viasocketserver.TCPServer+AsyncSSHHandler(each session runs its ownasyncio.run()internally)example-asyncio-test.py: 52 tests coveringMyServer,MyCommands(including asynctimer/passwd),ExampleTelnetHandler, and live integration tests against a realasyncio.start_server; added topytest testpathsREADME.md: fixed two-flavor references to three (threaded/green/asyncio), updated intro and "Serving the Handler" paragraph, updated "Short Example" to use asyncio, added descriptions to "Longer Example" and new "Asyncio Example" sectionspyproject.toml: version bumped to 1.0.2Test plan
uv run pytest— all 465 tests pass (includes the 52 new asyncio example tests)uv run black --check example-asyncio.py example-asyncio-test.py— cleanuv run flake8 example-asyncio.py example-asyncio-test.py— cleanpython example-asyncio.py 8023and connect with a telnet client to verify interactive behaviorpython example-asyncio.py 8022 --sshand connect with an SSH client to verify SSH path🤖 Generated with Claude Code