Skip to content

Commit ee44da7

Browse files
committed
style(storage): fix import ordering and formatting in system and unit tests
1 parent 934eddf commit ee44da7

3 files changed

Lines changed: 20 additions & 7 deletions

File tree

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import pytest # noqa: E402
3232
from google.api_core import exceptions # noqa: E402
3333
from google.api_core.client_options import ClientOptions # noqa: E402
34+
3435
from google.cloud import kms # noqa: E402
3536
from google.cloud.storage._helpers import _base64_md5hash # noqa: E402
3637
from google.cloud.storage.retry import DEFAULT_RETRY # noqa: E402
@@ -113,10 +114,12 @@ def _kms_key_name(client, bucket, key_name):
113114
key_name,
114115
)
115116

117+
116118
@pytest.fixture(scope="session")
117119
def run_system_tests_on_preprod():
118120
return os.getenv("RUN_SYSTEM_TESTS_ON_PREPROD") == "True"
119121

122+
120123
@pytest.fixture(scope="session")
121124
def storage_client(run_system_tests_on_preprod):
122125
from google.cloud.storage import Client

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

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
_RCU_BUCKET = os.getenv("RCU_BUCKET")
6262
_BUCKET_UNDER_TEST = _RCU_BUCKET if RCU_SYSTEM_TESTS else _ZONAL_BUCKET
6363

64+
6465
async def create_async_grpc_client(attempt_direct_path=True, preprod=False):
6566
"""Initializes async client and gets the current event loop."""
6667
return AsyncGrpcClient(
@@ -169,7 +170,10 @@ def _get_equal_dist(a: int, b: int) -> tuple[int, int]:
169170
step = (b - a) // 3
170171
return a + step, a + 2 * step
171172

172-
@pytest.mark.skipif(RCU_SYSTEM_TESTS, reason='X regions reads/writes for RCU not supported in SDK yet')
173+
174+
@pytest.mark.skipif(
175+
RCU_SYSTEM_TESTS, reason="X regions reads/writes for RCU not supported in SDK yet"
176+
)
173177
@pytest.mark.parametrize(
174178
"object_size",
175179
[
@@ -388,7 +392,10 @@ async def _run():
388392

389393
event_loop.run_until_complete(_run())
390394

391-
@pytest.mark.skipif(RCU_SYSTEM_TESTS, reason='Write from blob for RCU not supported in SDK yet')
395+
396+
@pytest.mark.skipif(
397+
RCU_SYSTEM_TESTS, reason="Write from blob for RCU not supported in SDK yet"
398+
)
392399
def test_write_from_blob(
393400
storage_client,
394401
blobs_to_delete,
@@ -441,7 +448,10 @@ async def _run():
441448
event_loop.run_until_complete(_run())
442449

443450

444-
@pytest.mark.skipif(RCU_SYSTEM_TESTS, reason='Write from blob with KMS key for RCU not supported in SDK yet')
451+
@pytest.mark.skipif(
452+
RCU_SYSTEM_TESTS,
453+
reason="Write from blob with KMS key for RCU not supported in SDK yet",
454+
)
445455
def test_write_from_blob_with_kms_key(
446456
storage_client,
447457
blobs_to_delete,
@@ -482,7 +492,9 @@ async def _run():
482492
event_loop.run_until_complete(_run())
483493

484494

485-
@pytest.mark.skipif(RCU_SYSTEM_TESTS, reason='Write blob with contexts for RCU not supported in SDK yet')
495+
@pytest.mark.skipif(
496+
RCU_SYSTEM_TESTS, reason="Write blob with contexts for RCU not supported in SDK yet"
497+
)
486498
@pytest.mark.asyncio
487499
async def test_write_blob_with_contexts(storage_client, blobs_to_delete):
488500
async_client = await create_async_grpc_client()

packages/google-cloud-storage/tests/unit/asyncio/test_async_write_object_stream.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,9 +139,7 @@ async def test_open_new_object_with_storage_class(
139139
initial_request = call_args.kwargs["initial_request"]
140140
assert initial_request.write_object_spec is not None
141141
assert initial_request.write_object_spec.resource.name == OBJECT
142-
assert (
143-
initial_request.write_object_spec.resource.storage_class == storage_class
144-
)
142+
assert initial_request.write_object_spec.resource.storage_class == storage_class
145143
assert initial_request.write_object_spec.appendable
146144

147145
assert stream.is_stream_open

0 commit comments

Comments
 (0)