Skip to content
This repository was archived by the owner on Mar 26, 2026. It is now read-only.

Commit f5d750a

Browse files
committed
fix miports
1 parent 53d6321 commit f5d750a

File tree

19 files changed

+52
-30
lines changed

19 files changed

+52
-30
lines changed

gapic/templates/%namespace/%name_%version/%sub/__init__.py.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ else: # pragma: NO COVER
2424
# An older version of api_core is installed, which does not define the
2525
# functions above. We do equivalent checks manually.
2626

27-
import logging
27+
import warnings
2828
import sys
2929

3030
_py_version_str = sys.version.split()[0]

tests/integration/goldens/asset/google/cloud/asset_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# An older version of api_core is installed, which does not define the
2828
# functions above. We do equivalent checks manually.
2929

30-
import logging
30+
import warnings
3131
import sys
3232

3333
_py_version_str = sys.version.split()[0]

tests/integration/goldens/asset/tests/unit/gapic/asset_v1/test_asset_service.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17725,7 +17725,7 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
1772517725
grpc_create_channel.return_value = mock_grpc_channel
1772617726

1772717727
cred = ga_credentials.AnonymousCredentials()
17728-
with pytest.warns(DeprecationWarning):
17728+
with pytest.warns(DeprecationWarning) as record:
1772917729
with mock.patch.object(google.auth, 'default') as adc:
1773017730
adc.return_value = (cred, None)
1773117731
transport = transport_class(
@@ -17734,6 +17734,7 @@ def test_asset_service_transport_channel_mtls_with_client_cert_source(
1773417734
client_cert_source=client_cert_source_callback,
1773517735
)
1773617736
adc.assert_called_once()
17737+
assert len(record) == 2
1773717738

1773817739
grpc_ssl_channel_cred.assert_called_once_with(
1773917740
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -17771,13 +17772,14 @@ def test_asset_service_transport_channel_mtls_with_adc(
1777117772
grpc_create_channel.return_value = mock_grpc_channel
1777217773
mock_cred = mock.Mock()
1777317774

17774-
with pytest.warns(DeprecationWarning):
17775+
with pytest.warns(DeprecationWarning) as record:
1777517776
transport = transport_class(
1777617777
host="squid.clam.whelk",
1777717778
credentials=mock_cred,
1777817779
api_mtls_endpoint="mtls.squid.clam.whelk",
1777917780
client_cert_source=None,
1778017781
)
17782+
assert len(record) == 1
1778117783

1778217784
grpc_create_channel.assert_called_once_with(
1778317785
"mtls.squid.clam.whelk:443",

tests/integration/goldens/credentials/google/iam/credentials_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# An older version of api_core is installed, which does not define the
2828
# functions above. We do equivalent checks manually.
2929

30-
import logging
30+
import warnings
3131
import sys
3232

3333
_py_version_str = sys.version.split()[0]

tests/integration/goldens/credentials/tests/unit/gapic/credentials_v1/test_iam_credentials.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3985,7 +3985,7 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
39853985
grpc_create_channel.return_value = mock_grpc_channel
39863986

39873987
cred = ga_credentials.AnonymousCredentials()
3988-
with pytest.warns(DeprecationWarning):
3988+
with pytest.warns(DeprecationWarning) as record:
39893989
with mock.patch.object(google.auth, 'default') as adc:
39903990
adc.return_value = (cred, None)
39913991
transport = transport_class(
@@ -3994,6 +3994,7 @@ def test_iam_credentials_transport_channel_mtls_with_client_cert_source(
39943994
client_cert_source=client_cert_source_callback,
39953995
)
39963996
adc.assert_called_once()
3997+
assert len(record) == 2
39973998

39983999
grpc_ssl_channel_cred.assert_called_once_with(
39994000
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -4031,13 +4032,14 @@ def test_iam_credentials_transport_channel_mtls_with_adc(
40314032
grpc_create_channel.return_value = mock_grpc_channel
40324033
mock_cred = mock.Mock()
40334034

4034-
with pytest.warns(DeprecationWarning):
4035+
with pytest.warns(DeprecationWarning) as record:
40354036
transport = transport_class(
40364037
host="squid.clam.whelk",
40374038
credentials=mock_cred,
40384039
api_mtls_endpoint="mtls.squid.clam.whelk",
40394040
client_cert_source=None,
40404041
)
4042+
assert len(record) == 1
40414043

40424044
grpc_create_channel.assert_called_once_with(
40434045
"mtls.squid.clam.whelk:443",

tests/integration/goldens/eventarc/google/cloud/eventarc_v1/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# An older version of api_core is installed, which does not define the
2828
# functions above. We do equivalent checks manually.
2929

30-
import logging
30+
import warnings
3131
import sys
3232

3333
_py_version_str = sys.version.split()[0]

tests/integration/goldens/eventarc/tests/unit/gapic/eventarc_v1/test_eventarc.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15391,7 +15391,7 @@ def test_eventarc_transport_channel_mtls_with_client_cert_source(
1539115391
grpc_create_channel.return_value = mock_grpc_channel
1539215392

1539315393
cred = ga_credentials.AnonymousCredentials()
15394-
with pytest.warns(DeprecationWarning):
15394+
with pytest.warns(DeprecationWarning) as record:
1539515395
with mock.patch.object(google.auth, 'default') as adc:
1539615396
adc.return_value = (cred, None)
1539715397
transport = transport_class(
@@ -15400,6 +15400,7 @@ def test_eventarc_transport_channel_mtls_with_client_cert_source(
1540015400
client_cert_source=client_cert_source_callback,
1540115401
)
1540215402
adc.assert_called_once()
15403+
assert len(record) == 2
1540315404

1540415405
grpc_ssl_channel_cred.assert_called_once_with(
1540515406
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -15437,13 +15438,14 @@ def test_eventarc_transport_channel_mtls_with_adc(
1543715438
grpc_create_channel.return_value = mock_grpc_channel
1543815439
mock_cred = mock.Mock()
1543915440

15440-
with pytest.warns(DeprecationWarning):
15441+
with pytest.warns(DeprecationWarning) as record:
1544115442
transport = transport_class(
1544215443
host="squid.clam.whelk",
1544315444
credentials=mock_cred,
1544415445
api_mtls_endpoint="mtls.squid.clam.whelk",
1544515446
client_cert_source=None,
1544615447
)
15448+
assert len(record) == 1
1544715449

1544815450
grpc_create_channel.assert_called_once_with(
1544915451
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging/google/cloud/logging_v2/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
# An older version of api_core is installed, which does not define the
2828
# functions above. We do equivalent checks manually.
2929

30-
import logging
30+
import warnings
3131
import sys
3232

3333
_py_version_str = sys.version.split()[0]

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_config_service_v2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12910,7 +12910,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1291012910
grpc_create_channel.return_value = mock_grpc_channel
1291112911

1291212912
cred = ga_credentials.AnonymousCredentials()
12913-
with pytest.warns(DeprecationWarning):
12913+
with pytest.warns(DeprecationWarning) as record:
1291412914
with mock.patch.object(google.auth, 'default') as adc:
1291512915
adc.return_value = (cred, None)
1291612916
transport = transport_class(
@@ -12919,6 +12919,7 @@ def test_config_service_v2_transport_channel_mtls_with_client_cert_source(
1291912919
client_cert_source=client_cert_source_callback,
1292012920
)
1292112921
adc.assert_called_once()
12922+
assert len(record) == 2
1292212923

1292312924
grpc_ssl_channel_cred.assert_called_once_with(
1292412925
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -12956,13 +12957,14 @@ def test_config_service_v2_transport_channel_mtls_with_adc(
1295612957
grpc_create_channel.return_value = mock_grpc_channel
1295712958
mock_cred = mock.Mock()
1295812959

12959-
with pytest.warns(DeprecationWarning):
12960+
with pytest.warns(DeprecationWarning) as record:
1296012961
transport = transport_class(
1296112962
host="squid.clam.whelk",
1296212963
credentials=mock_cred,
1296312964
api_mtls_endpoint="mtls.squid.clam.whelk",
1296412965
client_cert_source=None,
1296512966
)
12967+
assert len(record) == 1
1296612968

1296712969
grpc_create_channel.assert_called_once_with(
1296812970
"mtls.squid.clam.whelk:443",

tests/integration/goldens/logging/tests/unit/gapic/logging_v2/test_logging_service_v2.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3458,7 +3458,7 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34583458
grpc_create_channel.return_value = mock_grpc_channel
34593459

34603460
cred = ga_credentials.AnonymousCredentials()
3461-
with pytest.warns(DeprecationWarning):
3461+
with pytest.warns(DeprecationWarning) as record:
34623462
with mock.patch.object(google.auth, 'default') as adc:
34633463
adc.return_value = (cred, None)
34643464
transport = transport_class(
@@ -3467,6 +3467,7 @@ def test_logging_service_v2_transport_channel_mtls_with_client_cert_source(
34673467
client_cert_source=client_cert_source_callback,
34683468
)
34693469
adc.assert_called_once()
3470+
assert len(record) == 2
34703471

34713472
grpc_ssl_channel_cred.assert_called_once_with(
34723473
certificate_chain=b"cert bytes", private_key=b"key bytes"
@@ -3504,13 +3505,14 @@ def test_logging_service_v2_transport_channel_mtls_with_adc(
35043505
grpc_create_channel.return_value = mock_grpc_channel
35053506
mock_cred = mock.Mock()
35063507

3507-
with pytest.warns(DeprecationWarning):
3508+
with pytest.warns(DeprecationWarning) as record:
35083509
transport = transport_class(
35093510
host="squid.clam.whelk",
35103511
credentials=mock_cred,
35113512
api_mtls_endpoint="mtls.squid.clam.whelk",
35123513
client_cert_source=None,
35133514
)
3515+
assert len(record) == 1
35143516

35153517
grpc_create_channel.assert_called_once_with(
35163518
"mtls.squid.clam.whelk:443",

0 commit comments

Comments
 (0)