-
Notifications
You must be signed in to change notification settings - Fork 485
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add basic snapshot testing to python-sdk
- Loading branch information
Showing
3 changed files
with
42 additions
and
5 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
packages/python-sdk/tests/async/sandbox_async/test_snapshot.py
This file contains 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,17 @@ | ||
import pytest | ||
from e2b import AsyncSandbox | ||
|
||
|
||
@pytest.mark.skip_debug() | ||
async def test_snapshot(template): | ||
sbx = await AsyncSandbox.create(template, timeout=5) | ||
try: | ||
assert await sbx.is_running() | ||
|
||
sandbox_id = await sbx.pause() | ||
assert not await sbx.is_running() | ||
|
||
await sbx.resume(sandbox_id) | ||
assert await sbx.is_running() | ||
finally: | ||
await sbx.kill() |
This file contains 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
17 changes: 17 additions & 0 deletions
17
packages/python-sdk/tests/sync/sandbox_sync/test_snapshot.py
This file contains 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,17 @@ | ||
import pytest | ||
from e2b import Sandbox | ||
|
||
|
||
@pytest.mark.skip_debug() | ||
def test_snapshot(template): | ||
sbx = Sandbox(template, timeout=5) | ||
try: | ||
assert sbx.is_running() | ||
|
||
sandbox_id = sbx.pause() | ||
assert not sbx.is_running() | ||
|
||
sbx.resume(sandbox_id) | ||
assert sbx.is_running() | ||
finally: | ||
sbx.kill() |