33from e2b_code_interpreter .code_interpreter_async import AsyncSandbox
44
55
6- @pytest .mark .skip_debug ()
7- async def test_env_vars_sandbox ():
8- sbx = await AsyncSandbox .create (envs = {"FOO" : "bar" })
9- try :
10- result = await sbx .run_code ("import os; os.getenv('FOO')" )
11- assert result .text == "bar"
12- finally :
13- await sbx .kill ()
6+ # @pytest.mark.skip_debug()
7+ # async def test_env_vars_sandbox():
8+ # sbx = await AsyncSandbox.create(envs={"FOO": "bar"})
9+ # try:
10+ # result = await sbx.run_code("import os; os.getenv('FOO')")
11+ # assert result.text == "bar"
12+ # finally:
13+ # await sbx.kill()
1414
1515
1616async def test_env_vars_in_run_code (async_sandbox : AsyncSandbox ):
@@ -20,26 +20,27 @@ async def test_env_vars_in_run_code(async_sandbox: AsyncSandbox):
2020 assert result .text == "bar"
2121
2222
23- async def test_env_vars_override (debug : bool ):
24- sbx = await AsyncSandbox .create (envs = {"FOO" : "bar" , "SBX" : "value" })
25-
26- try :
27- await sbx .run_code (
28- "import os; os.environ['FOO'] = 'bar'; os.environ['RUNTIME_ENV'] = 'async_python_runtime'"
29- )
30- result = await sbx .run_code ("import os; os.getenv('FOO')" , envs = {"FOO" : "baz" })
31- assert result .text == "baz"
32-
33- # This can fail if running in debug mode (there's a race condition with the restart kernel test)
34- result = await sbx .run_code ("import os; os.getenv('RUNTIME_ENV')" )
35- assert result .text == "async_python_runtime"
36-
37- if not debug :
38- result = await sbx .run_code ("import os; os.getenv('SBX')" )
39- assert result .text == "value"
40-
41- # This can fail if running in debug mode (there's a race condition with the restart kernel test)
42- result = await sbx .run_code ("import os; os.getenv('FOO')" )
43- assert result .text == "bar"
44- finally :
45- await sbx .kill ()
23+ #
24+ # async def test_env_vars_override(debug: bool):
25+ # sbx = await AsyncSandbox.create(envs={"FOO": "bar", "SBX": "value"})
26+ #
27+ # try:
28+ # await sbx.run_code(
29+ # "import os; os.environ['FOO'] = 'bar'; os.environ['RUNTIME_ENV'] = 'async_python_runtime'"
30+ # )
31+ # result = await sbx.run_code("import os; os.getenv('FOO')", envs={"FOO": "baz"})
32+ # assert result.text == "baz"
33+ #
34+ # # This can fail if running in debug mode (there's a race condition with the restart kernel test)
35+ # result = await sbx.run_code("import os; os.getenv('RUNTIME_ENV')")
36+ # assert result.text == "async_python_runtime"
37+ #
38+ # if not debug:
39+ # result = await sbx.run_code("import os; os.getenv('SBX')")
40+ # assert result.text == "value"
41+ #
42+ # # This can fail if running in debug mode (there's a race condition with the restart kernel test)
43+ # result = await sbx.run_code("import os; os.getenv('FOO')")
44+ # assert result.text == "bar"
45+ # finally:
46+ # await sbx.kill()
0 commit comments