-
Notifications
You must be signed in to change notification settings - Fork 207
Expand file tree
/
Copy pathtest_async_cwd.py
More file actions
35 lines (24 loc) · 1.15 KB
/
test_async_cwd.py
File metadata and controls
35 lines (24 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import pytest
from e2b_code_interpreter.code_interpreter_async import AsyncSandbox
@pytest.mark.skip_debug()
async def test_cwd_python(async_sandbox: AsyncSandbox):
result = await async_sandbox.run_code("from pathlib import Path; print(Path.cwd())")
assert "".join(result.logs.stdout).strip() == "/home/user"
@pytest.mark.skip_debug()
async def test_cwd_javascript(async_sandbox: AsyncSandbox):
result = await async_sandbox.run_code("process.cwd()", language="js")
assert result.text == "/home/user"
@pytest.mark.skip_debug()
async def test_cwd_typescript(async_sandbox: AsyncSandbox):
result = await async_sandbox.run_code("process.cwd()", language="ts")
assert result.text == "/home/user"
@pytest.mark.skip_debug()
async def test_cwd_r(async_sandbox: AsyncSandbox):
result = await async_sandbox.run_code("getwd()", language="r")
assert result.results[0].text.strip() == '[1] "/home/user"'
@pytest.mark.skip_debug()
async def test_cwd_java(async_sandbox: AsyncSandbox):
result = await async_sandbox.run_code(
'System.getProperty("user.dir")', language="java"
)
assert result.results[0].text.strip() == "/home/user"