From 10b7af08be7b79d2161c0836a0a5a511ef32bcd9 Mon Sep 17 00:00:00 2001 From: Reinier van der Leer Date: Wed, 27 Sep 2023 19:50:25 -0400 Subject: [PATCH] AutoGPT: Fix challenges & plugin tests --- autogpts/autogpt/tests/challenges/utils.py | 9 +++++---- autogpts/autogpt/tests/conftest.py | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/autogpts/autogpt/tests/challenges/utils.py b/autogpts/autogpt/tests/challenges/utils.py index b12121ac9409..883f3f11bfbc 100644 --- a/autogpts/autogpt/tests/challenges/utils.py +++ b/autogpts/autogpt/tests/challenges/utils.py @@ -2,7 +2,7 @@ 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 be202ff656a3..ddc0c3efbb8c 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, )