Skip to content

Commit

Permalink
remove usage of pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
parthea committed Apr 9, 2024
1 parent 3be52af commit d736f6f
Showing 1 changed file with 13 additions and 19 deletions.
32 changes: 13 additions & 19 deletions src/python/grpcio_tests/tests/unit/_api_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import unittest

import grpc
import pytest

from tests.unit import _from_grpc_import_star
from tests.unit import test_common
Expand Down Expand Up @@ -112,23 +111,18 @@ def testChannelConnectivity(self):
)


@pytest.fixture(scope="class")
def compute_engine_channel_credentials(request):
class TestCallCredentials(grpc.AuthMetadataPlugin):
def __call__(self, context, callback):
callback((), None)

test_call_credentials = TestCallCredentials()
call_credentials = grpc.metadata_call_credentials(
test_call_credentials, "test call credentials"
)
request.cls.compute_engine_channel_credentials = (
grpc.compute_engine_channel_credentials(call_credentials)
)


@pytest.mark.usefixtures("compute_engine_channel_credentials")
class ChannelTest(unittest.TestCase):
def compute_engine_channel_credentials(self):
class TestCallCredentials(grpc.AuthMetadataPlugin):
def __call__(self, context, callback):
callback((), None)

test_call_credentials = TestCallCredentials()
call_credentials = grpc.metadata_call_credentials(
test_call_credentials, "test call credentials"
)
return grpc.compute_engine_channel_credentials(call_credentials)

def test_ssl_secure_channel(self):
channel = grpc.secure_channel(
"google.com:443", grpc.ssl_channel_credentials()
Expand All @@ -137,7 +131,7 @@ def test_ssl_secure_channel(self):

def test_compute_engine_secure_channel(self):
channel = grpc.secure_channel(
"google.com:443", self.compute_engine_channel_credentials
"google.com:443", self.compute_engine_channel_credentials()
)
channel.close()

Expand Down Expand Up @@ -171,7 +165,7 @@ def create_secure_channel():
wait_group.done()
wait_group.wait()
channel = grpc.secure_channel(
"google.com:443", self.compute_engine_channel_credentials
"google.com:443", self.compute_engine_channel_credentials()
)
channel.close()

Expand Down

0 comments on commit d736f6f

Please sign in to comment.