Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

AutoGPT: Fix challenges & plugin tests

Reinier van der Leer10b7af08be7b
diff --git a/autogpts/autogpt/tests/challenges/utils.py b/autogpts/autogpt/tests/challenges/utils.py
index b12121ac94..883f3f11bf 100644
--- a/autogpts/autogpt/tests/challenges/utils.py
+++ b/autogpts/autogpt/tests/challenges/utils.py
@@ -2,7 +2,7 @@ import contextlib
import random
import shutil
from pathlib import Path
-from typing import Any, Generator
+from typing import Any, AsyncIterator
import pytest
@@ -31,15 +31,16 @@ def setup_mock_input(monkeypatch: pytest.MonkeyPatch, cycle_count: int) -> None:
"""
input_sequence = ["y"] * (cycle_count) + ["EXIT"]
- def input_generator() -> Generator[str, None, None]:
+ async def input_generator() -> AsyncIterator[str]:
"""
Creates a generator that yields input strings from the given sequence.
"""
- yield from input_sequence
+ for input in input_sequence:
+ yield input
gen = input_generator()
monkeypatch.setattr(
- "autogpt.app.utils.session.prompt", lambda _, **kwargs: next(gen)
+ "autogpt.app.utils.session.prompt_async", lambda _, **kwargs: anext(gen)
)
diff --git a/autogpts/autogpt/tests/conftest.py b/autogpts/autogpt/tests/conftest.py
index be202ff656..ddc0c3efbb 100644
--- a/autogpts/autogpt/tests/conftest.py
+++ b/autogpts/autogpt/tests/conftest.py
@@ -63,7 +63,7 @@ def config(temp_plugins_config_file: str, mocker: MockerFixture, workspace: Work
from autogpt.plugins.plugins_config import PluginsConfig
config.plugins_config = PluginsConfig.load_config(
- plugins_config_file=config.plugins_config_file,
+ plugins_config_file=config.workdir / config.plugins_config_file,
plugins_denylist=config.plugins_denylist,
plugins_allowlist=config.plugins_allowlist,
)