Skip to content

Commit

Permalink
AutoGPT: Fix challenges & plugin tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Pwuts committed Sep 27, 2023
1 parent 5496a82 commit 10b7af0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions autogpts/autogpt/tests/challenges/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import random
import shutil
from pathlib import Path
from typing import Any, Generator
from typing import Any, AsyncIterator

import pytest

Expand Down Expand Up @@ -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)
)


Expand Down
2 changes: 1 addition & 1 deletion autogpts/autogpt/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down

0 comments on commit 10b7af0

Please sign in to comment.