aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Reinier van der Leer <pwuts@agpt.co> 2023-12-14 02:31:05 +0100
committerGravatar Reinier van der Leer <pwuts@agpt.co> 2023-12-14 02:31:05 +0100
commit167fea3f1e5a4d14feac7e5afe611bea59632bce (patch)
treea4e481967c6bbc01aadf2748c562b527c63873b2
parentlint: Remove unused `os` import in file_operations_utils.py (diff)
downloadAuto-GPT-167fea3f1e5a4d14feac7e5afe611bea59632bce.tar.gz
Auto-GPT-167fea3f1e5a4d14feac7e5afe611bea59632bce.tar.bz2
Auto-GPT-167fea3f1e5a4d14feac7e5afe611bea59632bce.zip
test: Speed up test_gcs_file_workspace
- Change the GCS workspace fixture to module level so it is only built and torn down once. This saves 30-40s on a test run.
-rw-r--r--autogpts/autogpt/tests/unit/test_gcs_file_workspace.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/autogpts/autogpt/tests/unit/test_gcs_file_workspace.py b/autogpts/autogpt/tests/unit/test_gcs_file_workspace.py
index 6372a91cd..bfc87e0a4 100644
--- a/autogpts/autogpt/tests/unit/test_gcs_file_workspace.py
+++ b/autogpts/autogpt/tests/unit/test_gcs_file_workspace.py
@@ -16,12 +16,12 @@ except GoogleAuthError:
pytest.skip("Google Cloud Authentication not configured", allow_module_level=True)
-@pytest.fixture
+@pytest.fixture(scope="module")
def gcs_bucket_name() -> str:
return f"test-bucket-{str(uuid.uuid4())[:8]}"
-@pytest.fixture
+@pytest.fixture(scope="module")
def gcs_workspace_uninitialized(gcs_bucket_name: str) -> GCSFileWorkspace:
os.environ["WORKSPACE_STORAGE_BUCKET"] = gcs_bucket_name
ws_config = GCSFileWorkspaceConfiguration.from_env()
@@ -49,7 +49,7 @@ def test_initialize(
bucket.delete(force=True)
-@pytest.fixture
+@pytest.fixture(scope="module")
def gcs_workspace(gcs_workspace_uninitialized: GCSFileWorkspace) -> GCSFileWorkspace:
(gcs_workspace := gcs_workspace_uninitialized).initialize()
yield gcs_workspace # type: ignore