-
Notifications
You must be signed in to change notification settings - Fork 206
Expand file tree
/
Copy pathtest_cwd.py
More file actions
33 lines (22 loc) · 1014 Bytes
/
test_cwd.py
File metadata and controls
33 lines (22 loc) · 1014 Bytes
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
import pytest
from e2b_code_interpreter.code_interpreter_sync import Sandbox
@pytest.mark.skip_debug()
def test_cwd_python(sandbox: Sandbox):
result = sandbox.run_code("from pathlib import Path; print(Path.cwd())")
assert "".join(result.logs.stdout).strip() == "/home/user"
@pytest.mark.skip_debug()
def test_cwd_javascript(sandbox: Sandbox):
result = sandbox.run_code("process.cwd()", language="js")
assert result.text == "/home/user"
@pytest.mark.skip_debug()
def test_cwd_typescript(sandbox: Sandbox):
result = sandbox.run_code("process.cwd()", language="ts")
assert result.text == "/home/user"
@pytest.mark.skip_debug()
def test_cwd_r(sandbox: Sandbox):
result = sandbox.run_code("getwd()", language="r")
assert result.results[0].text.strip() == '[1] "/home/user"'
@pytest.mark.skip_debug()
def test_cwd_java(sandbox: Sandbox):
result = sandbox.run_code('System.getProperty("user.dir")', language="java")
assert result.results[0].text.strip() == "/home/user"