Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

enhance: unify cleanup for all runtimes PR3775 (#3779)

Wendong-Fan200af9a73e5d
diff --git a/camel/runtimes/docker_runtime.py b/camel/runtimes/docker_runtime.py
index e08d7f7e9..2e8d650cb 100644
--- a/camel/runtimes/docker_runtime.py
+++ b/camel/runtimes/docker_runtime.py
@@ -408,7 +408,7 @@ class DockerRuntime(BaseRuntime):
def __exit__(self, exc_type, exc_val, exc_tb):
r"""Exit the context manager."""
- self.stop()
+ self.cleanup()
@property
def docs(self) -> str:
diff --git a/test/runtimes/test_base_runtime.py b/test/runtimes/test_base_runtime.py
index bb42c27de..04854222a 100644
--- a/test/runtimes/test_base_runtime.py
+++ b/test/runtimes/test_base_runtime.py
@@ -12,14 +12,13 @@
# limitations under the License.
# ========= Copyright 2023-2026 @ CAMEL-AI.org. All Rights Reserved. =========
-import pytest
-
from camel.runtimes import BaseRuntime
from camel.toolkits import FunctionTool
class _ConcreteRuntime(BaseRuntime):
- r"""Minimal concrete runtime for testing base cleanup/stop/context manager."""
+ r"""Minimal concrete runtime for testing base cleanup/stop/context
+ manager."""
def __init__(self):
super().__init__()
@@ -62,7 +61,8 @@ def test_base_runtime_stop_calls_cleanup():
def test_base_runtime_context_manager_calls_cleanup():
- r"""Test that using the runtime as a context manager calls cleanup on exit."""
+ r"""Test that using the runtime as a context manager calls cleanup on
+ exit."""
runtime = _ConcreteRuntime()
assert not runtime.cleanup_called
with runtime: