mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-22 16:34:25 +01:00
* Rearrange tests into unit/integration/challenge categories * Fix linting + `tests.challenges` imports * Fix obscured duplicate test in test_url_validation.py * Move VCR conftest to tests.vcr * Specify tests to run & their order (unit -> integration -> challenges) in CI * Fail Docker CI when tests fail * Fix import & linting errors in tests * Fix `get_text_summary` * Fix linting errors * Clean up pytest args in CI * Remove bogus tests from GoCodeo
46 lines
1.1 KiB
Python
46 lines
1.1 KiB
Python
from pathlib import Path
|
|
|
|
import pytest
|
|
from pytest_mock import MockerFixture
|
|
|
|
from autogpt.config.config import Config
|
|
from autogpt.llm.api_manager import ApiManager
|
|
from autogpt.workspace import Workspace
|
|
|
|
pytest_plugins = [
|
|
"tests.integration.agent_factory",
|
|
"tests.integration.memory.utils",
|
|
"tests.vcr",
|
|
]
|
|
|
|
|
|
@pytest.fixture()
|
|
def workspace_root(tmp_path: Path) -> Path:
|
|
return tmp_path / "home/users/monty/auto_gpt_workspace"
|
|
|
|
|
|
@pytest.fixture()
|
|
def workspace(workspace_root: Path) -> Workspace:
|
|
workspace_root = Workspace.make_workspace(workspace_root)
|
|
return Workspace(workspace_root, restrict_to_workspace=True)
|
|
|
|
|
|
@pytest.fixture()
|
|
def config(mocker: MockerFixture, workspace: Workspace) -> Config:
|
|
config = Config()
|
|
|
|
# Do a little setup and teardown since the config object is a singleton
|
|
mocker.patch.multiple(
|
|
config,
|
|
workspace_path=workspace.root,
|
|
file_logger_path=workspace.get_path("file_logger.txt"),
|
|
)
|
|
yield config
|
|
|
|
|
|
@pytest.fixture()
|
|
def api_manager() -> ApiManager:
|
|
if ApiManager in ApiManager._instances:
|
|
del ApiManager._instances[ApiManager]
|
|
return ApiManager()
|