Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Cleanup tests
Tomas Valenta836e3ccb65e6
diff --git a/.github/workflows/js_sdk_tests.yml b/.github/workflows/js_sdk_tests.ymlindex be9f92231..f727309e5 100644--- a/.github/workflows/js_sdk_tests.yml+++ b/.github/workflows/js_sdk_tests.yml@@ -57,8 +57,3 @@ jobs:run: pnpm run testenv:E2B_API_KEY: ${{ secrets.E2B_API_KEY }}-- - name: Run browser tests- run: pnpm run test:browser- env:- E2B_API_KEY: ${{ secrets.E2B_API_KEY }}diff --git a/.github/workflows/python_sdk_tests.yml b/.github/workflows/python_sdk_tests.ymlindex 0806cb196..3c8d367d8 100644--- a/.github/workflows/python_sdk_tests.yml+++ b/.github/workflows/python_sdk_tests.yml@@ -48,6 +48,6 @@ jobs:run: poetry build- name: Run tests- run: poetry run pytest -n auto+ run: poetry run pytest -n 1env:E2B_API_KEY: ${{ secrets.E2B_API_KEY }}diff --git a/packages/js-sdk/test/_smoke.test.mjs b/packages/js-sdk/test/_smoke.test.mjsindex 17060b4c7..b7b7f36e1 100644--- a/packages/js-sdk/test/_smoke.test.mjs+++ b/packages/js-sdk/test/_smoke.test.mjs@@ -1,9 +1,10 @@import { Session } from '../src'import { expect, test } from 'vitest'+import { id } from './setup.mjs'// Smoke test = quick, high-level, basic functionality testtest.skip('Smoke test', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.filesystem.makeDir('/test/new')const ls = await session.filesystem.list('/test')diff --git a/packages/js-sdk/test/cwd.test.mjs b/packages/js-sdk/test/cwd.test.mjsindex 59ae60bea..a8fb6a9d9 100644--- a/packages/js-sdk/test/cwd.test.mjs+++ b/packages/js-sdk/test/cwd.test.mjs@@ -1,54 +1,52 @@import { Session } from '../src'import { expect, test, vi } from 'vitest'-test(- 'custom cwd',- async () => {- const session = await Session.create({- id: 'Nodejs',- cwd: '/code/app',- })-- // change dir to /home/user- session.cwd = '/home/user'-- // process respects cwd- {- const proc = await session.process.start({ cmd: 'pwd' })- await proc.finished- const out = proc.output.stdout- expect(out).toEqual('/home/user')- }-- // filesystem respects cwd- {- await session.filesystem.write('hello.txt', 'Hello VM!')- const proc = await session.process.start({ cmd: 'cat /home/user/hello.txt' })- await proc.finished- const out = proc.output.stdout- expect(out).toEqual('Hello VM!')- }-- // call cd in process- {- const proc = await session.process.start({ cmd: 'cd /code' })- await proc.finished- }-- // process doesn't respect cd- {- const proc = await session.process.start({ cmd: 'pwd' })- await proc.finished- const out = proc.output.stdout- expect(out).toEqual('/home/user')- }- await session.close()- },- { timeout: 10_000 },-)+import { id } from './setup.mjs'++test('custom cwd', async () => {+ const session = await Session.create({+ id,+ cwd: '/code/app',+ })++ // change dir to /home/user+ session.cwd = '/home/user'++ // process respects cwd+ {+ const proc = await session.process.start({ cmd: 'pwd' })+ await proc.finished+ const out = proc.output.stdout+ expect(out).toEqual('/home/user')+ }++ // filesystem respects cwd+ {+ await session.filesystem.write('hello.txt', 'Hello VM!')+ const proc = await session.process.start({ cmd: 'cat /home/user/hello.txt' })+ await proc.finished+ const out = proc.output.stdout+ expect(out).toEqual('Hello VM!')+ }++ // call cd in process+ {+ const proc = await session.process.start({ cmd: 'cd /code' })+ await proc.finished+ }++ // process doesn't respect cd+ {+ const proc = await session.process.start({ cmd: 'pwd' })+ await proc.finished+ const out = proc.output.stdout+ expect(out).toEqual('/home/user')+ }+ await session.close()+})test('test_process_cwd', async () => {- const session = await Session.create({ id: 'Nodejs', cwd: '/code/app' })+ const session = await Session.create({ id, cwd: '/code/app' })const proc = await session.process.start({ cmd: 'pwd' })await proc.finishedexpect(proc.output.stdout).toEqual('/code/app')@@ -56,7 +54,7 @@ test('test_process_cwd', async () => {})test('test_filesystem_cwd', async () => {- const session = await Session.create({ id: 'Nodejs', cwd: '/code/app' })+ const session = await Session.create({ id, cwd: '/code/app' })await session.filesystem.write('hello.txt', 'Hello VM!')const proc = await session.process.start({ cmd: 'cat /code/app/hello.txt' })@@ -67,7 +65,7 @@ test('test_filesystem_cwd', async () => {})test('test_initial_cwd_with_tilde', async () => {- const session = await Session.create({ id: 'Nodejs', cwd: '~/code/' })+ const session = await Session.create({ id, cwd: '~/code/' })const proc = await session.process.start({ cmd: 'pwd' })await proc.finishedexpect(proc.output.stdout).toEqual('/home/user/code')@@ -75,7 +73,7 @@ test('test_initial_cwd_with_tilde', async () => {})test('test_relative_paths', async () => {- const session = await Session.create({ id: 'Nodejs', cwd: '/home/user' })+ const session = await Session.create({ id, cwd: '/home/user' })await session.filesystem.makeDir('./code')await session.filesystem.write('./code/hello.txt', 'Hello Vasek!')const proc = await session.process.start({ cmd: 'cat /home/user/code/hello.txt' })@@ -92,7 +90,7 @@ test('test_relative_paths', async () => {test('test_warnings', async () => {const session = await Session.create({- id: 'Nodejs',+ id,logger: { warn: vi.spyOn(console, 'warn') },})await session.filesystem.write('./hello.txt', 'Hello Vasek!')diff --git a/packages/js-sdk/test/envVars.test.mjs b/packages/js-sdk/test/envVars.test.mjsindex 253d85572..65f77f223 100644--- a/packages/js-sdk/test/envVars.test.mjs+++ b/packages/js-sdk/test/envVars.test.mjs@@ -1,8 +1,10 @@import { Session } from '../src'import { expect, test } from 'vitest'+import { id } from './setup.mjs'+test('test_env_vars', async () => {- const session = await Session.create({ id: 'Bash' })+ const session = await Session.create({ id })const process = await session.process.start({cmd: 'echo $FOO',@@ -16,7 +18,7 @@ test('test_env_vars', async () => {})test('test_profile_env_vars', async () => {- const session = await Session.create({ id: 'Bash' })+ const session = await Session.create({ id })await session.filesystem.write('/home/user/.profile', 'export FOO=BAR')const process = await session.process.start({ cmd: 'echo $FOO' })@@ -28,7 +30,7 @@ test('test_profile_env_vars', async () => {})test('test_default_env_vars', async () => {- const session = await Session.create({ id: 'Bash', envVars: { FOO: 'BAR' } })+ const session = await Session.create({ id, envVars: { FOO: 'BAR' } })const process = await session.process.start({ cmd: 'echo $FOO' })await process.finished@@ -39,7 +41,7 @@ test('test_default_env_vars', async () => {})test('test_overriding_env_vars', async () => {- const session = await Session.create({ id: 'Bash', envVars: { FOO: 'BAR' } })+ const session = await Session.create({ id, envVars: { FOO: 'BAR' } })const process = await session.process.start({cmd: 'echo $FOO',diff --git a/packages/js-sdk/test/fileUploadDownload.test.mjs b/packages/js-sdk/test/fileUploadDownload.test.mjsindex 251f4a07b..1cad431fb 100644--- a/packages/js-sdk/test/fileUploadDownload.test.mjs+++ b/packages/js-sdk/test/fileUploadDownload.test.mjs@@ -3,8 +3,10 @@ import { expect, test } from 'vitest'import * as fs from 'node:fs'import * as path from 'node:path'+import { id } from './setup.mjs'+test('upload and download file', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })const localFile = fs.readFileSync(path.join(__dirname, '/assets/video.webm'))diff --git a/packages/js-sdk/test/filesystem.test.mjs b/packages/js-sdk/test/filesystem.test.mjsindex 7de599db5..91fecc169 100644--- a/packages/js-sdk/test/filesystem.test.mjs+++ b/packages/js-sdk/test/filesystem.test.mjs@@ -2,9 +2,10 @@ import { Session } from '../src'import { expect, test } from 'vitest'import * as fs from 'node:fs'import * as path from 'node:path'+import { id } from './setup.mjs'test('list files', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.filesystem.makeDir('/test/new')const ls = await session.filesystem.list('/test')@@ -14,7 +15,7 @@ test('list files', async () => {})test('create file', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.filesystem.makeDir('/test')await session.filesystem.write('/test/test.txt', 'Hello World!')@@ -24,70 +25,58 @@ test('create file', async () => {await session.close()})-test(- 'read and write',- async () => {- const session = await Session.create({ id: 'Nodejs' })-- // String- await session.filesystem.write('/tmp/test.txt', 'Hello World!')- const content = await session.filesystem.read('/tmp/test.txt')- expect(content).toEqual('Hello World!')-- // Binary file- const binaryFile = fs.readFileSync(path.join(__dirname, '/assets/video.webm'))- await session.filesystem.writeBytes('/tmp/video.webm', binaryFile)- const binaryContent = await session.filesystem.readBytes('/tmp/video.webm')- expect(binaryContent).toEqual(binaryFile)-- await session.close()- },- { timeout: 10_000 },-)--test(- 'list delete files',- async () => {- const session = await Session.create({ id: 'Nodejs' })- await session.filesystem.makeDir('/test/new')-- let ls = await session.filesystem.list('/test')- expect(ls.map(x => x.name)).toEqual(['new'])-- await session.filesystem.remove('/test/new')-- ls = await session.filesystem.list('/test')- expect(ls.map(x => x.name)).toEqual([])-- await session.close()- },- { timeout: 10_000 },-)--test(- 'watch dir',- async () => {- const session = new Session({ id: 'Nodejs' })- await session.open()- await session.filesystem.write('/tmp/test.txt', 'Hello')-- const watcher = session.filesystem.watchDir('/tmp')-- const events = []- watcher.addEventListener(ev => events.push(ev))-- await watcher.start()- await session.filesystem.write('/tmp/test.txt', 'World!')- await new Promise(r => setTimeout(r, 2500))- await watcher.stop()-- expect(events.length).toBeGreaterThanOrEqual(1)-- const event = events[0]- expect(event['operation']).toEqual('Write')- expect(event['path']).toEqual('/tmp/test.txt')-- await session.close()- },- { timeout: 10_000 },-)+test('read and write', async () => {+ const session = await Session.create({ id })++ // String+ await session.filesystem.write('/tmp/test.txt', 'Hello World!')+ const content = await session.filesystem.read('/tmp/test.txt')+ expect(content).toEqual('Hello World!')++ // Binary file+ const binaryFile = fs.readFileSync(path.join(__dirname, '/assets/video.webm'))+ await session.filesystem.writeBytes('/tmp/video.webm', binaryFile)+ const binaryContent = await session.filesystem.readBytes('/tmp/video.webm')+ expect(binaryContent).toEqual(binaryFile)++ await session.close()+})++test('list delete files', async () => {+ const session = await Session.create({ id })+ await session.filesystem.makeDir('/test/new')++ let ls = await session.filesystem.list('/test')+ expect(ls.map(x => x.name)).toEqual(['new'])++ await session.filesystem.remove('/test/new')++ ls = await session.filesystem.list('/test')+ expect(ls.map(x => x.name)).toEqual([])++ await session.close()+})++test('watch dir', async () => {+ const session = new Session({ id })+ await session.open()+ await session.filesystem.write('/tmp/test.txt', 'Hello')++ const watcher = session.filesystem.watchDir('/tmp')++ const events = []+ watcher.addEventListener(ev => events.push(ev))++ await watcher.start()+ await session.filesystem.write('/tmp/test.txt', 'World!')+ await new Promise(r => setTimeout(r, 2500))+ await watcher.stop()++ expect(events.length).toBeGreaterThanOrEqual(1)++ const event = events[0]+ expect(event['operation']).toEqual('Write')+ expect(event['path']).toEqual('/tmp/test.txt')++ await session.close()+})diff --git a/packages/js-sdk/test/logging.test.mjs b/packages/js-sdk/test/logging.test.mjsindex 46426f095..86f25bec9 100644--- a/packages/js-sdk/test/logging.test.mjs+++ b/packages/js-sdk/test/logging.test.mjs@@ -1,7 +1,9 @@import { Session } from '../src'import { expect, test, vi } from 'vitest'-test('no logs in console during very basic scenario', async () => {+import { id } from './setup.mjs'++test.skip('no logs in console during very basic scenario', async () => {const consoleSpy = {debug: vi.spyOn(console, 'debug'),info: vi.spyOn(console, 'info'),@@ -9,7 +11,7 @@ test('no logs in console during very basic scenario', async () => {error: vi.spyOn(console, 'error'),}- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.filesystem.write('test.txt', 'Hello World')await session.close()@@ -27,7 +29,7 @@ test.skip('warn logs in console during convoluted scenario', async () => {error: vi.spyOn(console, 'error'),}- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.close() // Note that we are intentionally closing and then trying to writeconst warnsAmount = consoleSpy.warn.mock.calls.length@@ -38,7 +40,7 @@ test.skip('warn logs in console during convoluted scenario', async () => {}, 2000) // wait for some retries to occur})-test('verbose & info logs in console when opted-in', async () => {+test.skip('verbose & info logs in console when opted-in', async () => {const consoleSpy = {info: vi.spyOn(console, 'info'),warn: vi.spyOn(console, 'warn'),@@ -52,7 +54,7 @@ test('verbose & info logs in console when opted-in', async () => {}const session = await Session.create({- id: 'Nodejs',+ id,logger,})await session.filesystem.write('test.txt', 'Hello World')diff --git a/packages/js-sdk/test/process.test.mjs b/packages/js-sdk/test/process.test.mjsindex c270576a7..d66bb94bd 100644--- a/packages/js-sdk/test/process.test.mjs+++ b/packages/js-sdk/test/process.test.mjs@@ -1,8 +1,10 @@import { Session } from '../src'import { expect, test, vi } from 'vitest'+import { id } from './setup.mjs'+test('process on stdout/stderr', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })const stdout = []const stderr = []@@ -34,7 +36,7 @@ test('process expected stderr', async () => {})test('process on exit', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })const onExit = vi.fn(() => { })@@ -50,7 +52,7 @@ test('process on exit', async () => {})test('process send stdin', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })const process = await session.process.start({cmd: 'read -r line; echo "$line"',@@ -72,7 +74,7 @@ test('process send stdin', async () => {test('test default on exit', async () => {const onExit = vi.fn(() => { })- const session = await Session.create({ id: 'Nodejs', onExit })+ const session = await Session.create({ id, onExit })const processOverride = await session.process.start({cmd: 'pwd',onExit: console.log,diff --git a/packages/js-sdk/test/session.test.mjs b/packages/js-sdk/test/session.test.mjsindex 9eb444a94..821097c6a 100644--- a/packages/js-sdk/test/session.test.mjs+++ b/packages/js-sdk/test/session.test.mjs@@ -1,14 +1,16 @@import { Session } from '../src'import { test } from 'vitest'+import { id } from './setup.mjs'+test('create session', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await session.close()})test('create multiple sessions', async () => {- const session = await Session.create({ id: 'Nodejs' })- const session2 = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })+ const session2 = await Session.create({ id })await session.close()await session2.close()-}, 10000)+})diff --git a/packages/js-sdk/test/setup.mjs b/packages/js-sdk/test/setup.mjsnew file mode 100644index 000000000..81e928e86--- /dev/null+++ b/packages/js-sdk/test/setup.mjs@@ -0,0 +1 @@+export const id = 'Bash'diff --git a/packages/js-sdk/test/timeout.test.mjs b/packages/js-sdk/test/timeout.test.mjsindex 1931f0c5c..f73983aac 100644--- a/packages/js-sdk/test/timeout.test.mjs+++ b/packages/js-sdk/test/timeout.test.mjs@@ -3,15 +3,17 @@ import { expect, test } from 'vitest'import { Session } from '../src'import { TimeoutError } from '../src/error.ts'+import { id } from './setup.mjs'+// TODO: Make it work on CI and re-enable!test.skip('timeout session', async () => {- await expect(Session.create({ id: 'Nodejs', timeout: 10 })).rejects.toThrow()+ await expect(Session.create({ id, timeout: 10 })).rejects.toThrow()})// TODO: Make it work on CI and re-enable!test.skip('dont timeout session', async () => {const session = await Session.create({- id: 'Nodejs',+ id,timeout: 10000,})await session.close()@@ -19,7 +21,7 @@ test.skip('dont timeout session', async () => {// TODO: Make it work on CI and re-enable!test.skip('timeout filesystem', async () => {- const session = await Session.create({ id: 'Nodejs' })+ const session = await Session.create({ id })await expect(session.filesystem.write('/home/test.txt', 'Hello World', { timeout: 10 }),).rejects.toThrow(TimeoutError)@@ -53,20 +55,16 @@ test.skip('timeout process', async () => {})// TODO: Waiting for https://github.com/vitest-dev/vitest/issues/3119-test.skip(- 'timeout longer than cmd should not leak',- () =>- new Promise(async resolve => {- const session = await Session.create({ id: 'Nodejs' })- const proc = await session.process.start({- cmd: "node -e 'setTimeout(() => {}, 1000)'", // should take around 1 second- onExit: () => {- // TODO: Verify that process finished after successful cmd, and not after timeout- resolve()- },- timeout: 10_000, // but we give it 10 seconds- })- await proc.finished- }),- { timeout: 12_000 },-)+test.skip('timeout longer than cmd should not leak', () =>+ new Promise(async resolve => {+ const session = await Session.create({ id: 'Nodejs' })+ const proc = await session.process.start({+ cmd: "node -e 'setTimeout(() => {}, 1000)'", // should take around 1 second+ onExit: () => {+ // TODO: Verify that process finished after successful cmd, and not after timeout+ resolve()+ },+ timeout: 10_000, // but we give it 10 seconds+ })+ await proc.finished+ }))diff --git a/packages/js-sdk/tsconfig.json b/packages/js-sdk/tsconfig.jsonindex fd0599180..8980c3979 100644--- a/packages/js-sdk/tsconfig.json+++ b/packages/js-sdk/tsconfig.json@@ -2,7 +2,10 @@"compilerOptions": {"outDir": "dist","target": "es6",- "lib": ["dom", "ESNext"],+ "lib": [+ "dom",+ "ESNext"+ ],"sourceMap": true,"allowJs": true,"skipLibCheck": true,@@ -16,6 +19,12 @@"isolatedModules": true,"declaration": true},- "include": ["src"],- "exclude": ["dist", "node_modules", "rollup.config.js"]-}+ "include": [+ "src"+ ],+ "exclude": [+ "dist",+ "node_modules",+ "rollup.config.js"+ ]+}\ No newline at end of filediff --git a/packages/js-sdk/vitest.config.ts b/packages/js-sdk/vitest.config.tsindex e18526b02..7f7a58031 100644--- a/packages/js-sdk/vitest.config.ts+++ b/packages/js-sdk/vitest.config.ts@@ -4,6 +4,7 @@ export default defineConfig({test: {threads: false,globals: false,+ testTimeout: 20000,environment: 'node',server: {},deps: {diff --git a/packages/python-sdk/package.json b/packages/python-sdk/package.jsonindex cd7623bbf..d0b4d956c 100644--- a/packages/python-sdk/package.json+++ b/packages/python-sdk/package.json@@ -3,9 +3,9 @@"private": true,"version": "0.9.3","scripts": {- "test": "poetry run pytest -n auto",+ "test": "poetry run pytest -n 1","postVersion": "poetry version $(pnpm pkg get version --workspaces=false | tr -d \\\")","postPublish": "poetry build && poetry config pypi-token.pypi ${PYPI_TOKEN} && poetry publish --skip-existing","pretest": "poetry install"}-}+}\ No newline at end of filediff --git a/packages/python-sdk/tests/conftest.py b/packages/python-sdk/tests/conftest.pyindex 1470f6f4c..091039f3e 100644--- a/packages/python-sdk/tests/conftest.py+++ b/packages/python-sdk/tests/conftest.py@@ -1,5 +1,4 @@import csv-import pytestdiff --git a/packages/python-sdk/tests/infra/test_sudo.py b/packages/python-sdk/tests/infra/test_sudo.pyindex 503fea859..7d70129fd 100644--- a/packages/python-sdk/tests/infra/test_sudo.py+++ b/packages/python-sdk/tests/infra/test_sudo.py@@ -2,7 +2,7 @@ from e2b import Sessiondef test_sudo():- session = Session("Nodejs")+ session = Session("Bash")process = session.process.start("sudo echo test")process.wait()diff --git a/packages/python-sdk/tests/setup.py b/packages/python-sdk/tests/setup.pynew file mode 100644index 000000000..269964ded--- /dev/null+++ b/packages/python-sdk/tests/setup.py@@ -0,0 +1 @@+id = "Bash"diff --git a/packages/python-sdk/tests/test_cwd.py b/packages/python-sdk/tests/test_cwd.pyindex 400f963bf..6a69a207b 100644--- a/packages/python-sdk/tests/test_cwd.py+++ b/packages/python-sdk/tests/test_cwd.py@@ -1,10 +1,9 @@import pytest-from e2b import Sessiondef test_process_cwd():- session = Session("Nodejs", cwd="/code/app")+ session = Session("Bash", cwd="/code/app")proc = session.process.start("pwd")output = proc.wait()@@ -13,7 +12,7 @@ def test_process_cwd():def test_filesystem_cwd():- session = Session("Nodejs", cwd="/code/app")+ session = Session("Bash", cwd="/code/app")session.filesystem.write("hello.txt", "Hello VM!")proc = session.process.start("cat /code/app/hello.txt")@@ -24,7 +23,7 @@ def test_filesystem_cwd():def test_change_cwd():- session = Session("Nodejs", cwd="/code/app")+ session = Session("Bash", cwd="/code/app")# change dir to /home/usersession.cwd = "/home/user"@@ -44,7 +43,7 @@ def test_change_cwd():def test_initial_cwd_with_tilde():- session = Session("Nodejs", cwd="~/code/")+ session = Session("Bash", cwd="~/code/")proc = session.process.start("pwd")output = proc.wait()@@ -54,7 +53,7 @@ def test_initial_cwd_with_tilde():def test_relative_paths():- session = Session("Nodejs", cwd="/home/user")+ session = Session("Bash", cwd="/home/user")session.filesystem.make_dir("./code")session.filesystem.write("./code/hello.txt", "Hello Vasek!")@@ -71,7 +70,7 @@ def test_relative_paths():def test_warnings():- session = Session("Nodejs")+ session = Session("Bash")with pytest.warns(Warning):session.filesystem.write("./hello.txt", "Hello Vasek!")diff --git a/packages/python-sdk/tests/test_file_upload.py b/packages/python-sdk/tests/test_file_upload.pydeleted file mode 100644index c10acfc42..000000000--- a/packages/python-sdk/tests/test_file_upload.py+++ /dev/null@@ -1,18 +0,0 @@-from os import path--from e2b import Session---def test_file_upload():- file_name = "video.webm"- local_dir = "tests/assets"- filepath = path.join(local_dir, file_name)-- session = Session("Nodejs")- with open(filepath, "rb") as f:- session.upload_file(file=f)-- files = session.filesystem.list("/home/user")- assert file_name in [x.name for x in files]-- session.close()diff --git a/packages/python-sdk/tests/test_file_download.py b/packages/python-sdk/tests/test_file_upload_download.pysimilarity index 95%rename from packages/python-sdk/tests/test_file_download.pyrename to packages/python-sdk/tests/test_file_upload_download.pyindex 66e233e00..d64fca4f8 100644--- a/packages/python-sdk/tests/test_file_download.py+++ b/packages/python-sdk/tests/test_file_upload_download.py@@ -1,6 +1,6 @@import filecmp-from os import path+from os import pathfrom e2b import Session@@ -10,7 +10,7 @@ def test_download():local_path = path.join(local_dir, file_name)- session = Session("Nodejs")+ session = Session("Bash")# Upload the file first (it's uploaded to /home/user)with open(local_path, "rb") as f:diff --git a/packages/python-sdk/tests/test_filesystem.py b/packages/python-sdk/tests/test_filesystem.pyindex 4390e8e0a..fc74279b7 100644--- a/packages/python-sdk/tests/test_filesystem.py+++ b/packages/python-sdk/tests/test_filesystem.py@@ -1,4 +1,5 @@import filecmp+from os import pathfrom time import sleepfrom typing import List@@ -7,7 +8,7 @@ from e2b import Session, FilesystemEventdef test_list_files():- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.make_dir("/test/new")ls = session.filesystem.list("/test")@@ -17,7 +18,7 @@ def test_list_files():def test_create_file():- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.make_dir("/test")session.filesystem.write("/test/test.txt", "Hello World!")@@ -28,7 +29,7 @@ def test_create_file():def test_read_and_write():- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.write("/tmp/test.txt", "Hello World!")@@ -39,7 +40,7 @@ def test_read_and_write():def test_list_delete_files():- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.make_dir("/test/new")ls = session.filesystem.list("/test")@@ -54,7 +55,7 @@ def test_list_delete_files():def test_watch_dir():- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.write("/tmp/test.txt", "Hello")watcher = session.filesystem.watch_dir("/tmp")@@ -87,7 +88,7 @@ def test_write_bytes():# TODO: This test isn't complete since we can't verify the size of the file inside session.# We don't have any SDK function to get the size of a file inside session.- session = Session("Nodejs")+ session = Session("Bash")# Upload the filewith open(local_path, "rb") as f:@@ -112,7 +113,7 @@ def test_read_bytes():# TODO: This test isn't complete since we can't verify the size of the file inside session.# We don't have any SDK function to get the size of a file inside session.- session = Session("Nodejs")+ session = Session("Bash")# Upload the file firstwith open(local_path, "rb") as f:diff --git a/packages/python-sdk/tests/test_process.py b/packages/python-sdk/tests/test_process.pyindex a299e4be6..db7f3206a 100644--- a/packages/python-sdk/tests/test_process.py+++ b/packages/python-sdk/tests/test_process.py@@ -14,7 +14,7 @@ def test_process_expected_stderr():def test_process_on_stdout_stderr():- session = Session("Nodejs")+ session = Session("Bash")stdout = []stderr = []@@ -39,7 +39,7 @@ def test_process_on_stdout_stderr():def test_process_on_exit():- session = Session("Nodejs")+ session = Session("Bash")on_exit = MagicMock()@@ -55,7 +55,7 @@ def test_process_on_exit():def test_process_send_stdin():- session = Session("Nodejs")+ session = Session("Bash")proc = session.process.start('read -r line; echo "$line"',@@ -77,7 +77,7 @@ def test_process_send_stdin():def test_default_on_exit():on_exit = MagicMock()- session = Session("Nodejs", on_exit=lambda: on_exit())+ session = Session("Bash", on_exit=lambda: on_exit())proc = session.process.start("pwd",on_exit=lambda: print("EXIT"),diff --git a/packages/python-sdk/tests/test_session.py b/packages/python-sdk/tests/test_session.pyindex 1ce3d7519..21d4bab10 100644--- a/packages/python-sdk/tests/test_session.py+++ b/packages/python-sdk/tests/test_session.py@@ -2,12 +2,12 @@ from e2b import Sessiondef test_create_session():- session = Session("Nodejs")+ session = Session("Bash")session.close()def test_create_multiple_sessions():- session = Session("Nodejs")- session2 = Session("Nodejs")+ session = Session("Bash")+ session2 = Session("Bash")session.close()session2.close()diff --git a/packages/python-sdk/tests/test_timeout.py b/packages/python-sdk/tests/test_timeout.pyindex c41aa93d8..76902567a 100644--- a/packages/python-sdk/tests/test_timeout.py+++ b/packages/python-sdk/tests/test_timeout.py@@ -6,25 +6,33 @@ from e2b.session.exception import TimeoutExceptiondef test_create_session_timeout():with pytest.raises(TimeoutException):- Session("Nodejs", timeout=0.01)+ Session("Bash", timeout=0.01)def test_process_timeout():+ session: Session | None = None+with pytest.raises(TimeoutException):- session = Session("Nodejs")+ session = Session("Bash")session.process.start("sleep 1",timeout=0.01,)- session.close()++ if session:+ session.close()def test_filesystem_timeout():+ session: Session | None = None+with pytest.raises(TimeoutException):- session = Session("Nodejs")+ session = Session("Bash")session.filesystem.write("test.txt","Hello World",timeout=0.01,)- session.close()++ if session:+ session.close()