mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-30 03:00:41 -04:00
feat(forge): Add mount method to FileStorage & execute code in mounted workspace (#7115)
* Add `FileStorage.mount()` method, which mounts (part of) the workspace to a local path * Add `watchdog` library to watch file changes in mount * Amend `CodeExecutorComponent` * Amend `execute_python_file` to execute Python files in a workspace mount * Amend `execute_python_code` to create temporary .py file in workspace instead of as a local file * Add support for `Path` argument to `filename` parameter on `execute_python_file` * Fix `test_execute_python_code` (by making it async)
This commit is contained in:
committed by
GitHub
parent
edcbbbce25
commit
4e02f7ddb5
@@ -84,7 +84,8 @@ def test_execute_python_file_args(
|
||||
assert result == f"{random_args_string}\n"
|
||||
|
||||
|
||||
def test_execute_python_code(
|
||||
@pytest.mark.asyncio
|
||||
async def test_execute_python_code(
|
||||
code_executor_component: CodeExecutorComponent,
|
||||
random_code: str,
|
||||
random_string: str,
|
||||
@@ -93,7 +94,7 @@ def test_execute_python_code(
|
||||
if not (is_docker_available() or we_are_running_in_a_docker_container()):
|
||||
pytest.skip("Docker is not available")
|
||||
|
||||
result: str = code_executor_component.execute_python_code(random_code)
|
||||
result: str = await code_executor_component.execute_python_code(random_code)
|
||||
assert result.replace("\r", "") == f"Hello {random_string}!\n"
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user