This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
More doctests #271
Merged
Merged
More doctests #271
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
4a8f4ad
Run doctest from modules
NickCao 370fddd
jumpstarter-driver-power: replace regular tests with doctests
NickCao 5ffac57
fixup! Run doctest from modules
NickCao e9d0218
Replace EchoNetwork test with doctest
NickCao 79501d9
Document network drivers with doctests
NickCao 5602989
Add example config for all network drivers
NickCao 1c10837
Fixup tests
NickCao f345691
fixup! Fixup tests
NickCao f77b9db
Skip doctest blocks in autodoc
NickCao 8ac3140
Fixup buf.gen.yaml
NickCao d5e3ffe
Type checking with mypy
NickCao 7bef509
Add mypy target
NickCao 6ea2559
Type check pyserial
NickCao dfeb1bf
Add typed marker
NickCao 5c66baf
Fix various typing issue in can driver
NickCao 162a4e9
Add missing types stubs to network driver
NickCao 09d0c82
[HACK] Disable packages failing mypy
NickCao a95e5e3
Fix typing in http
NickCao 699b491
fixup! [HACK] Disable packages failing mypy
NickCao 0b69900
Merge branch 'main' into more-doctest
mangelajo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| from contextlib import contextmanager | ||
|
|
||
| import pytest | ||
|
|
||
| try: | ||
| from jumpstarter.common.utils import serve | ||
| from jumpstarter.config import ExporterConfigV1Alpha1DriverInstance | ||
| except ImportError: | ||
| # some packages in the workspace does not depend on jumpstarter | ||
| pass | ||
| else: | ||
|
|
||
| @contextmanager | ||
| def run(config): | ||
| with serve(ExporterConfigV1Alpha1DriverInstance.from_str(config).instantiate()) as client: | ||
| yield client | ||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def jumpstarter_namespace(doctest_namespace): | ||
| doctest_namespace["serve"] = serve | ||
| doctest_namespace["run"] = run |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # Network drivers | ||
|
|
||
| The network drivers are a set of drivers for interacting with network servers. | ||
|
|
||
| ## Driver configuration | ||
|
|
||
| ```{eval-rst} | ||
| .. autoclass:: jumpstarter_driver_network.driver.TcpNetwork() | ||
| ``` | ||
|
|
||
| ```{eval-rst} | ||
| .. autoclass:: jumpstarter_driver_network.driver.UdpNetwork() | ||
| ``` | ||
|
|
||
| ```{eval-rst} | ||
| .. autoclass:: jumpstarter_driver_network.driver.UnixNetwork() | ||
| ``` | ||
|
|
||
| ```{eval-rst} | ||
| .. autoclass:: jumpstarter_driver_network.driver.EchoNetwork() | ||
| ``` | ||
|
|
||
| ## Client API | ||
|
|
||
| ```{eval-rst} | ||
| .. autoclass:: jumpstarter_driver_network.client.NetworkClient() | ||
| :members: | ||
| ``` |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,3 +49,5 @@ | |
| "version": "0.5.0", | ||
| "controller_version": "0.5.0", | ||
| } | ||
|
|
||
| doctest_test_doctest_blocks = "" | ||
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
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
Empty file.
Empty file.
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
Empty file.
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
Empty file.
20 changes: 20 additions & 0 deletions
20
packages/jumpstarter-driver-network/jumpstarter_driver_network/conftest.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| import pytest | ||
| from anyio.from_thread import start_blocking_portal | ||
|
|
||
| from jumpstarter.common import TemporaryTcpListener | ||
|
|
||
|
|
||
| async def echo_handler(stream): | ||
| async with stream: | ||
| while True: | ||
| try: | ||
| await stream.send(await stream.receive()) | ||
| except Exception: | ||
| pass | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def tcp_echo_server(): | ||
| with start_blocking_portal() as portal: | ||
| with portal.wrap_async_context_manager(TemporaryTcpListener(echo_handler, local_host="127.0.0.1")) as addr: | ||
| yield addr |
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
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
Empty file.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.