Enable Bazel Python 3 for every PR

* Reverted hack in _reflection_servicer_test.py
* To see if Kokoro is happy about it
pull/17644/head
Lidi Zheng 6 years ago
parent 7105626569
commit 7df3475a9f
  1. 20
      src/python/grpcio_tests/tests/reflection/_reflection_servicer_test.py
  2. 1
      tools/internal_ci/linux/grpc_python_bazel_test_in_docker.sh

@ -50,16 +50,6 @@ def _file_descriptor_to_proto(descriptor):
class ReflectionServicerTest(unittest.TestCase):
# NOTE(lidiz) Bazel + Python 3 will result in creating two different
# instance of DESCRIPTOR for each message. So, the equal comparision
# between protobuf returned by stub and manually crafted protobuf will
# always fail.
def _assert_sequence_of_proto_equal(self, x, y):
self.assertSequenceEqual(
list(map(lambda x: x.SerializeToString(), x)),
list(map(lambda x: x.SerializeToString(), y)),
)
def setUp(self):
self._server = test_common.test_server()
reflection.enable_server_reflection(_SERVICE_NAMES, self._server)
@ -94,7 +84,7 @@ class ReflectionServicerTest(unittest.TestCase):
error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
)),
)
self._assert_sequence_of_proto_equal(expected_responses, responses)
self.assertSequenceEqual(expected_responses, responses)
def testFileBySymbol(self):
requests = (
@ -118,7 +108,7 @@ class ReflectionServicerTest(unittest.TestCase):
error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
)),
)
self._assert_sequence_of_proto_equal(expected_responses, responses)
self.assertSequenceEqual(expected_responses, responses)
def testFileContainingExtension(self):
requests = (
@ -147,7 +137,7 @@ class ReflectionServicerTest(unittest.TestCase):
error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
)),
)
self._assert_sequence_of_proto_equal(expected_responses, responses)
self.assertSequenceEqual(expected_responses, responses)
def testExtensionNumbersOfType(self):
requests = (
@ -172,7 +162,7 @@ class ReflectionServicerTest(unittest.TestCase):
error_message=grpc.StatusCode.NOT_FOUND.value[1].encode(),
)),
)
self._assert_sequence_of_proto_equal(expected_responses, responses)
self.assertSequenceEqual(expected_responses, responses)
def testListServices(self):
requests = (reflection_pb2.ServerReflectionRequest(list_services='',),)
@ -183,7 +173,7 @@ class ReflectionServicerTest(unittest.TestCase):
service=tuple(
reflection_pb2.ServiceResponse(name=name)
for name in _SERVICE_NAMES))),)
self._assert_sequence_of_proto_equal(expected_responses, responses)
self.assertSequenceEqual(expected_responses, responses)
def testReflectionServiceName(self):
self.assertEqual(reflection.SERVICE_NAME,

@ -25,3 +25,4 @@ git clone /var/local/jenkins/grpc /var/local/git/grpc
${name}')
cd /var/local/git/grpc/test
bazel test --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/...
bazel test --config=python3 --spawn_strategy=standalone --genrule_strategy=standalone --test_output=errors //src/python/...

Loading…
Cancel
Save