X Tutup
Skip to content

Commit 4975936

Browse files
authored
test: add check in pytest fixture (#1306)
1 parent 7ca369a commit 4975936

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/google-cloud-storage/tests/system/conftest.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,11 @@ def hierarchy_bucket_name():
150150
@pytest.fixture(scope="session")
151151
def hierarchy_bucket(storage_client, hierarchy_bucket_name, file_data):
152152
bucket = storage_client.bucket(hierarchy_bucket_name)
153-
_helpers.retry_429_503(bucket.create)()
153+
# Create the hierarchy bucket only if it doesn't yet exist.
154+
try:
155+
storage_client.get_bucket(bucket)
156+
except exceptions.NotFound:
157+
_helpers.retry_429_503(bucket.create)()
154158

155159
simple_path = _file_data["simple"]["path"]
156160
for filename in _hierarchy_filenames:

0 commit comments

Comments
 (0)
X Tutup