Skip to content

Commit

Permalink
Bug: Fix fixture scoping issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Poogles committed Mar 1, 2024
1 parent 7a1b5af commit b2d8517
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "pytest-gcs"
version = "0.0.2"
version = "0.0.3"
description = "GCS fixtures and fixture factories for Pytest."
readme = "README.md"
keywords = ["tests", "pytest", "fixture", "gcs"]
Expand Down
2 changes: 1 addition & 1 deletion pytest_gcs/factories/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def gcslocal(
Local GCS client factory.
"""

@pytest.fixture
@pytest.fixture(scope="session")
def gcslocal_factory(
request: FixtureRequest,
) -> Generator[storage.Client, None, None]:
Expand Down
12 changes: 12 additions & 0 deletions tests/test_gcs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""General plugin tests."""
import pytest
from google.cloud import storage

from pytest_gcs.executor.process import GCSExecutor
Expand Down Expand Up @@ -41,3 +42,14 @@ def test_gcs_write_read_files(gcs_proc: GCSExecutor, gcslocal: storage.Client) -
blob.upload_from_string(test_string)

assert bucket.get_blob(test_file).download_as_bytes().decode() == test_string


@pytest.fixture(scope="session")
def session_based_fixture(gcslocal1: storage.Client) -> None:
"""Empty fixture to validate clients are session scoped."""
pass


def test_validate_client_is_session_based(session_based_fixture: None) -> None:
"""Empty test that validates client is session scoped."""
pass

0 comments on commit b2d8517

Please sign in to comment.