Skip to content

Commit

Permalink
..
Browse files Browse the repository at this point in the history
  • Loading branch information
olgavrou committed Jan 5, 2024
1 parent 0342f0f commit 1f684c1
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/test_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,10 +305,16 @@ def test_execute_code(use_docker=None):
docker = None
if use_docker is None:
use_docker = docker is not None
exit_code, msg, image = execute_code("print('hello world')", filename="tmp/codetest.py", use_docker=use_docker)
exit_code, msg, image = execute_code(
"print('hello world')", filename="tmp/codetest.py", use_docker=use_docker, work_dir=f"{here}/my_tmp1"
)
assert exit_code == 0 and msg == "hello world\n", msg
# read a file
print(execute_code("with open('tmp/codetest.py', 'r') as f: a=f.read()", use_docker=use_docker))
print(
execute_code(
"with open('tmp/codetest.py', 'r') as f: a=f.read()", use_docker=use_docker, work_dir=f"{here}/my_tmp1"
)
)
# create a file
exit_code, msg, image = execute_code(
"with open('tmp/codetest.py', 'w') as f: f.write('b=1')",
Expand Down

0 comments on commit 1f684c1

Please sign in to comment.