mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-22 16:34:25 +01:00
* gfeat: specify directory of cassettes and automatically load them depending on module fix: formatting for linter test: commit newly generated cassettes to their respective folder tests: update latest fixtures with master fix: update .gitattributes with updated path to cassettes fix: use cassettes from master instead of generating them myself fix: update path in .gitattributes fix: make sure to match default functionality by using test name for cassette directory fix: actually add git submodule ci: checkout git submodules in CI ci: update git submodules separately to ensure it gets called feat: add a hooks directory so we can update git submodules on post-checkout feat: make sure we push the tests/cassettes submodule on merge into master ci: remove unused code now that we are using git submodules to keep cassettes in sync fix: simplify how we load the submodule and fix updating cassettes on merge to master chore: remove echo of checkout hook, it's unneeded ci: remove unneccesary step * cassettes submodule * cassettes submodule * cassettes submodule * cassettes submodule * cassettes submodule --------- Co-authored-by: Stefan Ayala <stefanayala3266@gmail.com>
51 lines
1.3 KiB
Python
51 lines
1.3 KiB
Python
import os
|
|
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"]
|
|
|
|
PROXY = os.environ.get("PROXY")
|
|
|
|
|
|
@pytest.fixture()
|
|
def vcr_cassette_dir(request):
|
|
test_name = os.path.splitext(request.node.name)[0]
|
|
return os.path.join("tests/Auto-GPT-test-cassettes", test_name)
|
|
|
|
|
|
@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()
|