mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-19 15:04:26 +01:00
AutoGPT: Fix challenges & plugin tests
This commit is contained in:
@@ -2,7 +2,7 @@ import contextlib
|
|||||||
import random
|
import random
|
||||||
import shutil
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Generator
|
from typing import Any, AsyncIterator
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
@@ -31,15 +31,16 @@ def setup_mock_input(monkeypatch: pytest.MonkeyPatch, cycle_count: int) -> None:
|
|||||||
"""
|
"""
|
||||||
input_sequence = ["y"] * (cycle_count) + ["EXIT"]
|
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.
|
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()
|
gen = input_generator()
|
||||||
monkeypatch.setattr(
|
monkeypatch.setattr(
|
||||||
"autogpt.app.utils.session.prompt", lambda _, **kwargs: next(gen)
|
"autogpt.app.utils.session.prompt_async", lambda _, **kwargs: anext(gen)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ def config(temp_plugins_config_file: str, mocker: MockerFixture, workspace: Work
|
|||||||
from autogpt.plugins.plugins_config import PluginsConfig
|
from autogpt.plugins.plugins_config import PluginsConfig
|
||||||
|
|
||||||
config.plugins_config = PluginsConfig.load_config(
|
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_denylist=config.plugins_denylist,
|
||||||
plugins_allowlist=config.plugins_allowlist,
|
plugins_allowlist=config.plugins_allowlist,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user