Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Improve tests setup
Tomas Valenta08f1fc6bac7b
diff --git a/packages/python-sdk/pytest.ini b/packages/python-sdk/pytest.iniindex 7776d099a..394756e69 100644--- a/packages/python-sdk/pytest.ini+++ b/packages/python-sdk/pytest.ini@@ -3,4 +3,5 @@markers =skip_debug: skip test if E2B_DEBUG is set.-addopts = "--import-mode=importlib"+asyncio_mode=auto+addopts = "--import-mode=importlib" "--numprocesses=auto"diff --git a/packages/python-sdk/tests/async/api_async/test_sbx_kill.py b/packages/python-sdk/tests/async/api_async/test_sbx_kill.pyindex 0276e6e67..5e9a9d80a 100644--- a/packages/python-sdk/tests/async/api_async/test_sbx_kill.py+++ b/packages/python-sdk/tests/async/api_async/test_sbx_kill.py@@ -4,7 +4,6 @@ from e2b import AsyncSandbox@pytest.mark.skip_debug()async def test_kill_existing_sandbox(async_sandbox: AsyncSandbox):assert await AsyncSandbox.kill(async_sandbox.sandbox_id) == True@@ -13,6 +12,5 @@ async def test_kill_existing_sandbox(async_sandbox: AsyncSandbox):@pytest.mark.skip_debug()async def test_kill_non_existing_sandbox():assert await AsyncSandbox.kill("non-existing-sandbox") == Falsediff --git a/packages/python-sdk/tests/async/api_async/test_sbx_list.py b/packages/python-sdk/tests/async/api_async/test_sbx_list.pyindex a661bfc13..0388c6c9b 100644--- a/packages/python-sdk/tests/async/api_async/test_sbx_list.py+++ b/packages/python-sdk/tests/async/api_async/test_sbx_list.py@@ -4,7 +4,6 @@ from e2b import AsyncSandbox@pytest.mark.skip_debug()async def test_list_sandboxes(async_sandbox: AsyncSandbox):sandboxes = await AsyncSandbox.list()assert len(sandboxes) > 0diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_connect.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_connect.pyindex 24e46f129..5b0835003 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_connect.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_connect.py@@ -3,7 +3,6 @@ import pytestfrom e2b import NotFoundException, AsyncSandboxasync def test_connect_to_process(async_sandbox: AsyncSandbox):cmd = await async_sandbox.commands.run("sleep 10", background=True)pid = cmd.pid@@ -12,7 +11,6 @@ async def test_connect_to_process(async_sandbox: AsyncSandbox):assert process_info.pid == pidasync def test_connect_to_non_existing_process(async_sandbox: AsyncSandbox):non_existing_pid = 999999diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_kill.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_kill.pyindex 5d89daef1..c121e8c57 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_kill.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_kill.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandbox, ProcessExitExceptionasync def test_kill_process(async_sandbox: AsyncSandbox):cmd = await async_sandbox.commands.run("sleep 10", background=True)pid = cmd.pid@@ -14,7 +13,6 @@ async def test_kill_process(async_sandbox: AsyncSandbox):await async_sandbox.commands.run(f"kill -0 {pid}")async def test_kill_non_existing_process(async_sandbox: AsyncSandbox):non_existing_pid = 999999diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.pyindex 372eb483c..3ac8a1858 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_cmd_list.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_kill_process(async_sandbox: AsyncSandbox):c1 = await async_sandbox.commands.run("sleep 10", background=True)c2 = await async_sandbox.commands.run("sleep 10", background=True)diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_run.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_run.pyindex 9bfb48747..87bda9855 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_run.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_run.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandbox, TimeoutExceptionasync def test_run(async_sandbox: AsyncSandbox):text = "Hello, World!"@@ -13,7 +12,6 @@ async def test_run(async_sandbox: AsyncSandbox):assert cmd.stdout == f"{text}\n"async def test_run_with_special_characters(async_sandbox: AsyncSandbox):text = "!@#$%^&*()_+"@@ -23,7 +21,6 @@ async def test_run_with_special_characters(async_sandbox: AsyncSandbox):assert cmd.stdout == f"{text}\n"async def test_run_with_multiline_string(async_sandbox: AsyncSandbox):text = "Hello,\nWorld!"@@ -33,14 +30,12 @@ async def test_run_with_multiline_string(async_sandbox: AsyncSandbox):assert cmd.stdout == f"{text}\n"async def test_run_with_timeout(async_sandbox: AsyncSandbox):cmd = await async_sandbox.commands.run('echo "Hello, World!"', timeout=10)assert cmd.exit_code == 0async def test_run_with_too_short_timeout(async_sandbox: AsyncSandbox):with pytest.raises(TimeoutException):await async_sandbox.commands.run("sleep 10", timeout=2)diff --git a/packages/python-sdk/tests/async/sandbox_async/commands/test_send_stdin.py b/packages/python-sdk/tests/async/sandbox_async/commands/test_send_stdin.pyindex daaeac28b..58d93abd2 100644--- a/packages/python-sdk/tests/async/sandbox_async/commands/test_send_stdin.py+++ b/packages/python-sdk/tests/async/sandbox_async/commands/test_send_stdin.py@@ -4,7 +4,6 @@ import asynciofrom e2b import AsyncSandboxasync def test_send_stdin_to_process(async_sandbox: AsyncSandbox):ev = asyncio.Event()@@ -23,7 +22,6 @@ async def test_send_stdin_to_process(async_sandbox: AsyncSandbox):assert cmd.stdout == "Hello, World!"async def test_send_special_characters_to_process(async_sandbox: AsyncSandbox):ev = asyncio.Event()@@ -42,7 +40,6 @@ async def test_send_special_characters_to_process(async_sandbox: AsyncSandbox):assert cmd.stdout == "!@#$%^&*()_+"async def test_send_multiline_string_to_process(async_sandbox: AsyncSandbox):ev = asyncio.Event()diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py b/packages/python-sdk/tests/async/sandbox_async/files/test_exists.pyindex dc7057d6b..346e82dc4 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_exists.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_exists(async_sandbox: AsyncSandbox):filename = "test_exists.txt"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_files_list.py b/packages/python-sdk/tests/async/sandbox_async/files/test_files_list.pyindex 7a527811a..a23959774 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_files_list.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_files_list.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandbox, FileTypeasync def test_list_directory(async_sandbox: AsyncSandbox):dir_name = "test_directory"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_make_dir.py b/packages/python-sdk/tests/async/sandbox_async/files/test_make_dir.pyindex e95b98866..a4d8ada97 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_make_dir.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_make_dir.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_make_directory(async_sandbox: AsyncSandbox):dir_name = "test_directory"@@ -12,7 +11,6 @@ async def test_make_directory(async_sandbox: AsyncSandbox):assert existsasync def test_make_nested_directory(async_sandbox: AsyncSandbox):nested_dir_name = "test_directory/nested_directory"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_read.py b/packages/python-sdk/tests/async/sandbox_async/files/test_read.pyindex 164cae5da..83cce7894 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_read.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_read.py@@ -3,7 +3,6 @@ import pytestfrom e2b import NotFoundException, AsyncSandboxasync def test_read_file(async_sandbox: AsyncSandbox):filename = "test_read.txt"content = "Hello, world!"@@ -13,7 +12,6 @@ async def test_read_file(async_sandbox: AsyncSandbox):assert read_content == contentasync def test_read_non_existing_file(async_sandbox: AsyncSandbox):filename = "non_existing_file.txt"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py b/packages/python-sdk/tests/async/sandbox_async/files/test_remove.pyindex f1c69dd86..b2f4c8fcd 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_remove.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_remove_file(async_sandbox: AsyncSandbox):filename = "test_remove.txt"content = "This file will be removed."@@ -14,7 +13,6 @@ async def test_remove_file(async_sandbox: AsyncSandbox):assert not existsasync def test_remove_non_existing_file(async_sandbox: AsyncSandbox):filename = "non_existing_file.txt"await async_sandbox.files.remove(filename)diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_rename.py b/packages/python-sdk/tests/async/sandbox_async/files/test_rename.pyindex 24bd8e1fb..3ab756261 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_rename.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_rename.py@@ -3,7 +3,6 @@ import pytestfrom e2b import NotFoundException, AsyncSandboxasync def test_rename_file(async_sandbox: AsyncSandbox):old_filename = "test_rename_old.txt"new_filename = "test_rename_new.txt"@@ -19,7 +18,6 @@ async def test_rename_file(async_sandbox: AsyncSandbox):assert read_content == contentasync def test_rename_non_existing_file(async_sandbox: AsyncSandbox):old_filename = "non_existing_file.txt"new_filename = "new_non_existing_file.txt"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py b/packages/python-sdk/tests/async/sandbox_async/files/test_watch.pyindex d2bf3c4a7..23ba9f3ee 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_watch.py@@ -5,7 +5,6 @@ from asyncio import Eventfrom e2b import NotFoundException, AsyncSandbox, FilesystemEvent, FilesystemEventTypeasync def test_watch_directory_changes(async_sandbox: AsyncSandbox):dirname = "test_watch_dir"filename = "test_watch.txt"@@ -30,7 +29,6 @@ async def test_watch_directory_changes(async_sandbox: AsyncSandbox):await handle.close()async def test_watch_non_existing_directory(async_sandbox: AsyncSandbox):dirname = "non_existing_watch_dir"diff --git a/packages/python-sdk/tests/async/sandbox_async/files/test_write.py b/packages/python-sdk/tests/async/sandbox_async/files/test_write.pyindex b0fc9e072..a942e96c3 100644--- a/packages/python-sdk/tests/async/sandbox_async/files/test_write.py+++ b/packages/python-sdk/tests/async/sandbox_async/files/test_write.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_write_file(async_sandbox: AsyncSandbox):filename = "test_write.txt"content = "This is a test file."@@ -16,7 +15,6 @@ async def test_write_file(async_sandbox: AsyncSandbox):assert read_content == contentasync def test_overwrite_file(async_sandbox: AsyncSandbox):filename = "test_overwrite.txt"initial_content = "Initial content."@@ -28,7 +26,6 @@ async def test_overwrite_file(async_sandbox: AsyncSandbox):assert read_content == new_contentasync def test_write_to_non_existing_directory(async_sandbox: AsyncSandbox):filename = "non_existing_dir/test_write.txt"content = "This should succeed too."diff --git a/packages/python-sdk/tests/async/sandbox_async/test_connect.py b/packages/python-sdk/tests/async/sandbox_async/test_connect.pyindex d700d7b5d..dbb746353 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_connect.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_connect.py@@ -3,7 +3,6 @@ import pytestfrom e2b import AsyncSandboxasync def test_connect(template):sbx = await AsyncSandbox.create(template, timeout=10)try:diff --git a/packages/python-sdk/tests/async/sandbox_async/test_create.py b/packages/python-sdk/tests/async/sandbox_async/test_create.pyindex ed8319419..f4a75c9fa 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_create.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_create.py@@ -4,7 +4,6 @@ from e2b import AsyncSandbox@pytest.mark.skip_debug()async def test_start(template):sbx = await AsyncSandbox.create(template, timeout=5)try:@@ -14,7 +13,6 @@ async def test_start(template):@pytest.mark.skip_debug()async def test_metadata(template):sbx = await AsyncSandbox.create(template, timeout=5, metadata={"test-key": "test-value"}diff --git a/packages/python-sdk/tests/async/sandbox_async/test_host.py b/packages/python-sdk/tests/async/sandbox_async/test_host.pyindex 624d0e421..a8bd3c74c 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_host.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_host.py@@ -6,7 +6,6 @@ from time import sleepfrom e2b import AsyncSandboxasync def test_ping_server(async_sandbox: AsyncSandbox, debug):cmd = await async_sandbox.commands.run("python -m http.server 8000",diff --git a/packages/python-sdk/tests/async/sandbox_async/test_kill.py b/packages/python-sdk/tests/async/sandbox_async/test_kill.pyindex 19c1cf040..ea44b2fb7 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_kill.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_kill.py@@ -4,7 +4,6 @@ from e2b import AsyncSandbox@pytest.mark.skip_debug()async def test_kill(async_sandbox: AsyncSandbox):await async_sandbox.kill()diff --git a/packages/python-sdk/tests/async/sandbox_async/test_timeout.py b/packages/python-sdk/tests/async/sandbox_async/test_timeout.pyindex 980b85277..349904a89 100644--- a/packages/python-sdk/tests/async/sandbox_async/test_timeout.py+++ b/packages/python-sdk/tests/async/sandbox_async/test_timeout.py@@ -17,7 +17,6 @@ async def test_shorten_timeout(async_sandbox: AsyncSandbox):@pytest.mark.skip_debug()async def test_shorten_then_lengthen_timeout(async_sandbox: AsyncSandbox):await async_sandbox.set_timeout(5)sleep(1)