π OpenHands: AI-Driven Development
Style/add return type hints (#5274)
Cheng Yang71be744f2ef9
diff --git a/tests/runtime/conftest.py b/tests/runtime/conftest.pyindex 2a57a9c820..aa08a2cb73 100644--- a/tests/runtime/conftest.py+++ b/tests/runtime/conftest.py@@ -29,16 +29,16 @@ project_dir = os.path.dirname(sandbox_test_folder = '/openhands/workspace'-def _get_runtime_sid(runtime: Runtime):+def _get_runtime_sid(runtime: Runtime) -> str:logger.debug(f'\nruntime.sid: {runtime.sid}')return runtime.sid-def _get_host_folder(runtime: Runtime):+def _get_host_folder(runtime: Runtime) -> str:return runtime.config.workspace_mount_path-def _get_sandbox_folder(runtime: Runtime):+def _get_sandbox_folder(runtime: Runtime) -> Path | None:sid = _get_runtime_sid(runtime)if sid:return Path(os.path.join(sandbox_test_folder, sid))@@ -61,7 +61,7 @@ def _remove_folder(folder: str) -> bool:return success-def _close_test_runtime(runtime: Runtime):+def _close_test_runtime(runtime: Runtime) -> None:if isinstance(runtime, EventStreamRuntime):runtime.close(rm_all_containers=False)else:@@ -69,7 +69,7 @@ def _close_test_runtime(runtime: Runtime):time.sleep(1)-def _reset_pwd():+def _reset_pwd() -> None:global project_dir# Try to change back to project directorytry:@@ -97,6 +97,7 @@ def print_method_name(request):@pytest.fixturedef temp_dir(tmp_path_factory: TempPathFactory, request) -> str:"""Creates a unique temporary directory.+Upon finalization, the temporary directory and its content is removed.The cleanup function is also called upon KeyboardInterrupt.@@ -126,7 +127,7 @@ def temp_dir(tmp_path_factory: TempPathFactory, request) -> str:# Depending on TEST_RUNTIME, feed the appropriate box class(es) to the test.-def get_runtime_classes():+def get_runtime_classes() -> list[type[Runtime]]:runtime = TEST_RUNTIMEif runtime.lower() == 'eventstream':return [EventStreamRuntime]@@ -138,7 +139,7 @@ def get_runtime_classes():raise ValueError(f'Invalid runtime: {runtime}')-def get_run_as_openhands():+def get_run_as_openhands() -> list[bool]:print('\n\n########################################################################')