Skip to content

Commit 4e3be17

Browse files
committed
cleanup
1 parent 30c6ecc commit 4e3be17

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

packages/gapic-generator/tests/system/test_pqc.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import grpc
16+
from packaging.version import Version
1517
import pytest
1618
from google import showcase
1719

@@ -22,17 +24,7 @@ def run_pqc_test(use_mtls):
2224
pytest.skip("PQC integration test requires mTLS (--mtls flag) to be enabled.")
2325

2426

25-
def _require_pqc_support(transport_name):
26-
# TODO(Phase 3): Remove this check once grpcio >= 1.83.0 is enforced across all client libraries.
27-
if transport_name == "grpc":
28-
import grpc
29-
from packaging.version import Version
30-
if Version(grpc.__version__) < Version("1.83.0rc0"):
31-
pytest.skip(f"gRPC PQC negotiation requires grpcio >= 1.83.0 (current: {grpc.__version__})")
32-
33-
3427
def _verify_pqc_negotiated_group(client, interceptor, transport_name):
35-
_require_pqc_support(transport_name)
3628
# Make secure call using standard GAPIC client library fixture
3729
response = client.echo(request=showcase.EchoRequest(content="Verify PQC connection."))
3830
assert response.content == "Verify PQC connection."
@@ -59,6 +51,10 @@ def _verify_pqc_negotiated_group(client, interceptor, transport_name):
5951

6052
def test_pqc_grpc(run_pqc_test, intercepted_echo_grpc):
6153
"""Verifies that the gRPC client library negotiates PQC (X25519MLKEM768) with Showcase server."""
54+
# TODO(Phase 3): Remove this check once grpcio >= 1.83.0 is enforced across all client libraries.
55+
if Version(grpc.__version__) < Version("1.83.0rc0"):
56+
pytest.skip(f"gRPC PQC negotiation requires grpcio >= 1.83.0 (current: {grpc.__version__})")
57+
6258
client, interceptor = intercepted_echo_grpc
6359
_verify_pqc_negotiated_group(client, interceptor, "grpc")
6460

@@ -68,3 +64,4 @@ def test_pqc_rest(run_pqc_test, intercepted_echo_rest):
6864
client, interceptor = intercepted_echo_rest
6965
_verify_pqc_negotiated_group(client, interceptor, "rest")
7066

67+

0 commit comments

Comments
 (0)