@@ -58,7 +58,7 @@ def get_box_classes():
58
58
elif runtime .lower () == 'server' :
59
59
return [ServerRuntime ]
60
60
else :
61
- return [EventStreamRuntime , ServerRuntime ]
61
+ return [ServerRuntime , EventStreamRuntime ]
62
62
63
63
64
64
# This assures that all tests run together per runtime, not alternating between them,
@@ -141,9 +141,6 @@ async def _load_runtime(
141
141
runtime = ServerRuntime (
142
142
config = config , event_stream = event_stream , sid = sid , plugins = plugins
143
143
)
144
- assert (
145
- runtime .sandbox .run_as_devin == run_as_devin
146
- ), f'run_as_devin in sandbox should be { run_as_devin } '
147
144
await runtime .ainit ()
148
145
from opendevin .runtime .tools import (
149
146
RuntimeTool , # deprecate this after ServerRuntime is deprecated
@@ -792,6 +789,9 @@ async def test_ipython_simple(temp_dir, box_class):
792
789
logger .info (obs , extra = {'msg_type' : 'OBSERVATION' })
793
790
assert obs .content .strip () == '1'
794
791
792
+ await runtime .close ()
793
+ await asyncio .sleep (1 )
794
+
795
795
796
796
async def _test_ipython_agentskills_fileop_pwd_impl (
797
797
runtime : ServerRuntime | EventStreamRuntime , enable_auto_lint : bool
@@ -904,40 +904,45 @@ async def _test_ipython_agentskills_fileop_pwd_impl(
904
904
905
905
906
906
@pytest .mark .asyncio
907
- async def test_ipython_agentskills_fileop_pwd (temp_dir , box_class , enable_auto_lint ):
907
+ async def test_ipython_agentskills_fileop_pwd (
908
+ temp_dir , box_class , run_as_devin , enable_auto_lint
909
+ ):
908
910
"""Make sure that cd in bash also update the current working directory in ipython."""
909
911
910
912
runtime = await _load_runtime (
911
- temp_dir , box_class , enable_auto_lint = enable_auto_lint
913
+ temp_dir , box_class , run_as_devin , enable_auto_lint = enable_auto_lint
912
914
)
913
915
await _test_ipython_agentskills_fileop_pwd_impl (runtime , enable_auto_lint )
916
+
914
917
await runtime .close ()
915
918
await asyncio .sleep (1 )
916
919
917
920
918
- @pytest .mark .skipif (
919
- TEST_RUNTIME .lower () == 'eventstream' ,
920
- reason = 'Skip this if we want to test EventStreamRuntime' ,
921
- )
922
921
@pytest .mark .skipif (
923
922
os .environ .get ('TEST_IN_CI' , 'false' ).lower () == 'true' ,
924
923
# FIXME: There's some weird issue with the CI environment.
925
924
reason = 'Skip this if in CI.' ,
926
925
)
927
926
@pytest .mark .asyncio
928
927
async def test_ipython_agentskills_fileop_pwd_agnostic_sandbox (
929
- temp_dir , enable_auto_lint , container_image
928
+ temp_dir , box_class , run_as_devin , enable_auto_lint , container_image
930
929
):
931
- """Make sure that cd in bash also update the current working directory in ipython."""
930
+ """Make sure that cd in bash also updates the current working directory in iPython."""
931
+
932
+ # NOTE: we only test for ServerRuntime, since EventStreamRuntime
933
+ # is image agnostic by design.
934
+ if box_class != 'server' :
935
+ pytest .skip ('Skip this if box_class is not server' )
932
936
933
937
runtime = await _load_runtime (
934
938
temp_dir ,
935
- # NOTE: we only test for ServerRuntime, since EventStreamRuntime is image agnostic by design.
936
- ServerRuntime ,
939
+ box_class ,
940
+ run_as_devin ,
937
941
enable_auto_lint = enable_auto_lint ,
938
942
container_image = container_image ,
939
943
)
940
944
await _test_ipython_agentskills_fileop_pwd_impl (runtime , enable_auto_lint )
945
+
941
946
await runtime .close ()
942
947
await asyncio .sleep (1 )
943
948
@@ -1030,6 +1035,9 @@ async def test_copy_single_file(temp_dir, box_class):
1030
1035
assert obs .exit_code == 0
1031
1036
assert 'Hello, World!' in obs .content
1032
1037
1038
+ await runtime .close ()
1039
+ await asyncio .sleep (1 )
1040
+
1033
1041
1034
1042
def _create_test_dir_with_files (host_temp_dir ):
1035
1043
os .mkdir (os .path .join (host_temp_dir , 'test_dir' ))
@@ -1077,6 +1085,9 @@ async def test_copy_directory_recursively(temp_dir, box_class):
1077
1085
assert obs .exit_code == 0
1078
1086
assert 'File 1 content' in obs .content
1079
1087
1088
+ await runtime .close ()
1089
+ await asyncio .sleep (1 )
1090
+
1080
1091
1081
1092
@pytest .mark .asyncio
1082
1093
async def test_copy_to_non_existent_directory (temp_dir , box_class ):
@@ -1096,6 +1107,9 @@ async def test_copy_to_non_existent_directory(temp_dir, box_class):
1096
1107
assert obs .exit_code == 0
1097
1108
assert 'Hello, World!' in obs .content
1098
1109
1110
+ await runtime .close ()
1111
+ await asyncio .sleep (1 )
1112
+
1099
1113
1100
1114
@pytest .mark .asyncio
1101
1115
async def test_overwrite_existing_file (temp_dir , box_class ):
@@ -1131,6 +1145,9 @@ async def test_overwrite_existing_file(temp_dir, box_class):
1131
1145
assert obs .exit_code == 0
1132
1146
assert 'Hello, World!' in obs .content
1133
1147
1148
+ await runtime .close ()
1149
+ await asyncio .sleep (1 )
1150
+
1134
1151
1135
1152
@pytest .mark .asyncio
1136
1153
async def test_copy_non_existent_file (temp_dir , box_class ):
@@ -1148,3 +1165,6 @@ async def test_copy_non_existent_file(temp_dir, box_class):
1148
1165
logger .info (obs , extra = {'msg_type' : 'OBSERVATION' })
1149
1166
assert isinstance (obs , CmdOutputObservation )
1150
1167
assert obs .exit_code != 0 # File should not exist
1168
+
1169
+ await runtime .close ()
1170
+ await asyncio .sleep (1 )
0 commit comments