Skip to content

Commit 83581b2

Browse files
committed
add logic to skip test in test_file itself
1 parent 0c7ae3f commit 83581b2

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

gcsfs/tests/test_extended_gcsfs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,7 @@ def test_read_small_zb(extended_gcsfs, zonal_mocks):
154154
# cache drop
155155
assert len(f.cache.cache) < len(out)
156156
if mocks:
157-
mocks["get_bucket_type"].assert_called_once_with(
158-
TEST_ZONAL_BUCKET
159-
)
157+
mocks["get_bucket_type"].assert_called_once_with(TEST_ZONAL_BUCKET)
160158

161159

162160
def test_readline_zb(extended_gcsfs, zonal_mocks):

gcsfs/tests/test_zonal_file.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""Tests for ZonalFile write operations."""
22

3+
import os
34
from unittest import mock
45

56
import pytest
@@ -10,6 +11,17 @@
1011
file_path = f"{TEST_BUCKET}/zonal-file-test"
1112
test_data = b"hello world"
1213

14+
REQUIRED_ENV_VAR = "GCSFS_EXPERIMENTAL_ZB_HNS_SUPPORT"
15+
16+
# If the condition is True, only then tests in this file are run.
17+
should_run = os.getenv(REQUIRED_ENV_VAR, "false").lower() in (
18+
"true",
19+
"1",
20+
)
21+
pytestmark = pytest.mark.skipif(
22+
not should_run, reason=f"Skipping tests: {REQUIRED_ENV_VAR} env variable is not set"
23+
)
24+
1325

1426
@pytest.fixture
1527
def zonal_write_mocks():

0 commit comments

Comments
 (0)