E2B/packages/python-sdk/tests/test_timeout.py
Jakub Novák 388309830b
New infra (#212)
Co-authored-by: Tomas Valenta <valenta.and.thomas@gmail.com>
Co-authored-by: Vasek Mlejnsky <vasek.mlejnsky@gmail.com>
2023-11-06 15:07:09 +01:00

44 lines
854 B
Python

import pytest
from e2b import Sandbox
from e2b.sandbox.exception import TimeoutException
def test_create_sandbox_timeout():
sandbox: Sandbox | None = None
with pytest.raises(TimeoutException):
sandbox = Sandbox(timeout=0.01)
if sandbox:
sandbox.close()
def test_process_timeout():
sandbox: Sandbox | None = None
with pytest.raises(TimeoutException):
sandbox = Sandbox()
sandbox.process.start(
"sleep 1",
timeout=0.01,
)
if sandbox:
sandbox.close()
def test_filesystem_timeout():
sandbox: Sandbox | None = None
with pytest.raises(TimeoutException):
sandbox = Sandbox()
sandbox.filesystem.write(
"test.txt",
"Hello World",
timeout=0.01,
)
if sandbox:
sandbox.close()