[Python run_test] Revert "Revert "[Python run_test] Fix run_test"" (#34671)

Reverts grpc/grpc#34667

The change was reverted because it failed to import to g3, after some
changes, now it's safe to reapply those changes.

Tested by importing this PR internally, it passed presubmit:
cl/573836270
pull/34606/head
Xuan Wang 1 year ago committed by GitHub
parent f832772d89
commit 43661ab364
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pxd.pxi
  2. 5
      src/python/grpcio/grpc/_cython/_cygrpc/aio/server.pyx.pxi
  3. 117
      src/python/grpcio_tests/commands.py
  4. 2
      src/python/grpcio_tests/setup.py
  5. 3
      src/python/grpcio_tests/tests/_sanity/_sanity_test.py
  6. 6
      src/python/grpcio_tests/tests/admin/BUILD.bazel
  7. 13
      src/python/grpcio_tests/tests/admin/__init__.py
  8. 0
      src/python/grpcio_tests/tests/admin/admin_test.py
  9. 6
      src/python/grpcio_tests/tests/csds/BUILD.bazel
  10. 13
      src/python/grpcio_tests/tests/csds/__init__.py
  11. 1
      src/python/grpcio_tests/tests/csds/csds_test.py
  12. 184
      src/python/grpcio_tests/tests/tests.json
  13. 7
      src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py
  14. 84
      src/python/grpcio_tests/tests_aio/tests.json
  15. 6
      src/python/grpcio_tests/tests_aio/unit/metadata_test.py
  16. 16
      src/python/grpcio_tests/tests_aio/unit/server_test.py
  17. 1
      src/python/grpcio_tests/tests_gevent/tests.json
  18. 2
      templates/tools/dockerfile/compile_python_310.include
  19. 2
      templates/tools/dockerfile/compile_python_311.include
  20. 2
      templates/tools/dockerfile/compile_python_37.include
  21. 2
      templates/tools/dockerfile/compile_python_38.include
  22. 4
      templates/tools/dockerfile/test/python_debian11_default_arm64/Dockerfile.template
  23. 4
      templates/tools/dockerfile/test/python_debian11_default_x64/Dockerfile.template
  24. 4
      tools/bazelify_tests/dockerimage_current_versions.bzl
  25. 2
      tools/distrib/python/xds_protos/build.py
  26. 2
      tools/dockerfile/test/python_debian11_default_arm64.current_version
  27. 4
      tools/dockerfile/test/python_debian11_default_arm64/Dockerfile
  28. 2
      tools/dockerfile/test/python_debian11_default_x64.current_version
  29. 12
      tools/dockerfile/test/python_debian11_default_x64/Dockerfile
  30. 2
      tools/run_tests/artifacts/build_artifact_python.sh
  31. 2
      tools/run_tests/helper_scripts/build_python.sh
  32. 7
      tools/run_tests/run_tests.py

@ -29,6 +29,7 @@ cdef class RPCState(GrpcCallWrapper):
cdef bint metadata_sent
cdef bint status_sent
cdef grpc_status_code status_code
cdef object py_status_code
cdef str status_details
cdef tuple trailing_metadata
cdef object compression_algorithm

@ -55,6 +55,7 @@ cdef class RPCState:
self.metadata_sent = False
self.status_sent = False
self.status_code = StatusCode.ok
self.py_status_code = None
self.status_details = ''
self.trailing_metadata = _IMMUTABLE_EMPTY_METADATA
self.compression_algorithm = None
@ -184,6 +185,7 @@ cdef class _ServicerContext:
self._rpc_state.status_details = details
actual_code = get_status_code(code)
self._rpc_state.py_status_code = code
self._rpc_state.status_code = actual_code
self._rpc_state.status_sent = True
@ -213,9 +215,10 @@ cdef class _ServicerContext:
def set_code(self, object code):
self._rpc_state.status_code = get_status_code(code)
self._rpc_state.py_status_code = code
def code(self):
return self._rpc_state.status_code
return self._rpc_state.py_status_code
def set_details(self, str details):
self._rpc_state.status_details = details

@ -152,123 +152,6 @@ class TestAio(setuptools.Command):
sys.exit("Test failure")
class TestGevent(setuptools.Command):
"""Command to run tests w/gevent."""
BANNED_TESTS = (
# Fork support is not compatible with gevent
"fork._fork_interop_test.ForkInteropTest",
# These tests send a lot of RPCs and are really slow on gevent. They will
# eventually succeed, but need to dig into performance issues.
"unit._cython._no_messages_server_completion_queue_per_call_test.Test.test_rpcs",
"unit._cython._no_messages_single_server_completion_queue_test.Test.test_rpcs",
"unit._compression_test",
# TODO(https://github.com/grpc/grpc/issues/16890) enable this test
"unit._cython._channel_test.ChannelTest.test_multiple_channels_lonely_connectivity",
# I have no idea why this doesn't work in gevent, but it shouldn't even be
# using the c-core
"testing._client_test.ClientTest.test_infinite_request_stream_real_time",
# TODO(https://github.com/grpc/grpc/issues/15743) enable this test
"unit._session_cache_test.SSLSessionCacheTest.testSSLSessionCacheLRU",
# TODO(https://github.com/grpc/grpc/issues/14789) enable this test
"unit._server_ssl_cert_config_test",
# TODO(https://github.com/grpc/grpc/issues/14901) enable this test
"protoc_plugin._python_plugin_test.PythonPluginTest",
"protoc_plugin._python_plugin_test.SimpleStubsPluginTest",
# Beta API is unsupported for gevent
"protoc_plugin.beta_python_plugin_test",
"unit.beta._beta_features_test",
# TODO(https://github.com/grpc/grpc/issues/15411) unpin gevent version
# This test will stuck while running higher version of gevent
"unit._auth_context_test.AuthContextTest.testSessionResumption",
# TODO(https://github.com/grpc/grpc/issues/15411) enable these tests
"unit._channel_ready_future_test.ChannelReadyFutureTest.test_immediately_connectable_channel_connectivity",
"unit._cython._channel_test.ChannelTest.test_single_channel_lonely_connectivity",
"unit._exit_test.ExitTest.test_in_flight_unary_unary_call",
"unit._exit_test.ExitTest.test_in_flight_unary_stream_call",
"unit._exit_test.ExitTest.test_in_flight_stream_unary_call",
"unit._exit_test.ExitTest.test_in_flight_stream_stream_call",
"unit._exit_test.ExitTest.test_in_flight_partial_unary_stream_call",
"unit._exit_test.ExitTest.test_in_flight_partial_stream_unary_call",
"unit._exit_test.ExitTest.test_in_flight_partial_stream_stream_call",
# TODO(https://github.com/grpc/grpc/issues/18980): Reenable.
"unit._signal_handling_test.SignalHandlingTest",
"unit._metadata_flags_test",
"health_check._health_servicer_test.HealthServicerTest.test_cancelled_watch_removed_from_watch_list",
# TODO(https://github.com/grpc/grpc/issues/17330) enable these three tests
"channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels",
"channelz._channelz_servicer_test.ChannelzServicerTest.test_many_subchannels_and_sockets",
"channelz._channelz_servicer_test.ChannelzServicerTest.test_streaming_rpc",
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
"unit._cython._channel_test.ChannelTest.test_negative_deadline_connectivity",
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
"unit._local_credentials_test.LocalCredentialsTest",
# TODO(https://github.com/grpc/grpc/issues/22020) LocalCredentials
# aren't supported with custom io managers.
"unit._contextvars_propagation_test",
"testing._time_test.StrictRealTimeTest",
)
BANNED_WINDOWS_TESTS = (
# TODO(https://github.com/grpc/grpc/pull/15411) enable this test
"unit._dns_resolver_test.DNSResolverTest.test_connect_loopback",
# TODO(https://github.com/grpc/grpc/pull/15411) enable this test
"unit._server_test.ServerTest.test_failed_port_binding_exception",
)
BANNED_MACOS_TESTS = (
# TODO(https://github.com/grpc/grpc/issues/15411) enable this test
"unit._dynamic_stubs_test.DynamicStubTest",
)
description = "run tests with gevent. Assumes grpc/gevent are installed"
user_options = []
def initialize_options(self):
pass
def finalize_options(self):
# distutils requires this override.
pass
def run(self):
import gevent
from gevent import monkey
monkey.patch_all()
threadpool = gevent.hub.get_hub().threadpool
# Currently, each channel corresponds to a single native thread in the
# gevent threadpool. Thus, when the unit test suite spins up hundreds of
# channels concurrently, some will be starved out, causing the test to
# increase in duration. We increase the max size here so this does not
# happen.
threadpool.maxsize = 1024
threadpool.size = 32
import grpc.experimental.gevent
import tests
grpc.experimental.gevent.init_gevent()
import gevent
import tests
loader = tests.Loader()
loader.loadTestsFromNames(["tests", "tests_gevent"])
runner = tests.Runner()
if sys.platform == "win32":
runner.skip_tests(self.BANNED_TESTS + self.BANNED_WINDOWS_TESTS)
elif sys.platform == "darwin":
runner.skip_tests(self.BANNED_TESTS + self.BANNED_MACOS_TESTS)
else:
runner.skip_tests(self.BANNED_TESTS)
result = gevent.spawn(runner.run, loader.suite)
result.join()
if not result.value.wasSuccessful():
sys.exit("Test failure")
class RunInterop(test.test):
description = "run interop test client/server"
user_options = [

@ -43,6 +43,7 @@ INSTALL_REQUIRES = (
"grpcio-status>={version}".format(version=grpc_version.VERSION),
"grpcio-tools>={version}".format(version=grpc_version.VERSION),
"grpcio-health-checking>={version}".format(version=grpc_version.VERSION),
"xds-protos>={version}".format(version=grpc_version.VERSION),
"oauth2client>=1.4.7",
"protobuf>=4.21.6rc1,!=4.22.0.*",
"google-auth>=1.17.2",
@ -58,7 +59,6 @@ COMMAND_CLASS = {
"run_fork": commands.RunFork,
"run_interop": commands.RunInterop,
"test_lite": commands.TestLite,
"test_gevent": commands.TestGevent,
"test_aio": commands.TestAio,
"test_py3_only": commands.TestPy3Only,
}

@ -39,9 +39,10 @@ class SanityTest(unittest.TestCase):
)
tests_json_string = pkgutil.get_data(self.TEST_PKG_PATH, "tests.json")
tests_json = tests_json_string.decode()
tests_json = json.loads(tests_json_string.decode())
self.assertSequenceEqual(tests_json, test_suite_names)
self.assertGreater(len(test_suite_names), 0)
if __name__ == "__main__":

@ -13,10 +13,10 @@
# limitations under the License.
py_test(
name = "test_admin",
name = "admin_test",
size = "small",
srcs = ["test_admin.py"],
main = "test_admin.py",
srcs = ["admin_test.py"],
main = "admin_test.py",
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",

@ -0,0 +1,13 @@
# Copyright 2023 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@ -13,10 +13,10 @@
# limitations under the License.
py_test(
name = "test_csds",
name = "csds_test",
size = "small",
srcs = ["test_csds.py"],
main = "test_csds.py",
srcs = ["csds_test.py"],
main = "csds_test.py",
python_version = "PY3",
deps = [
"//src/python/grpcio/grpc:grpcio",

@ -0,0 +1,13 @@
# Copyright 2023 The gRPC Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

@ -120,7 +120,6 @@ class TestCsds(unittest.TestCase):
break
except KeyError as e:
logging.debug("Invalid config: %s\n%s: %s", config, type(e), e)
pass
if ok:
break
time.sleep(1)

@ -1,93 +1,95 @@
[
"_sanity._sanity_test.SanityTest",
"admin.test_admin.TestAdmin",
"channelz._channelz_servicer_test.ChannelzServicerTest",
"csds.test_csds.TestCsds",
"fork._fork_interop_test.ForkInteropTest",
"health_check._health_servicer_test.HealthServicerBackwardsCompatibleWatchTest",
"health_check._health_servicer_test.HealthServicerTest",
"interop._insecure_intraop_test.InsecureIntraopTest",
"interop._secure_intraop_test.SecureIntraopTest",
"protoc_plugin._python_plugin_test.ModuleMainTest",
"protoc_plugin._python_plugin_test.PythonPluginTest",
"protoc_plugin._python_plugin_test.SimpleStubsPluginTest",
"protoc_plugin._split_definitions_test.SameProtoGrpcBeforeProtoProtocStyleTest",
"protoc_plugin._split_definitions_test.SameProtoMid2016ProtocStyleTest",
"protoc_plugin._split_definitions_test.SameProtoProtoBeforeGrpcProtocStyleTest",
"protoc_plugin._split_definitions_test.SameProtoSingleProtocExecutionProtocStyleTest",
"protoc_plugin._split_definitions_test.SplitProtoGrpcBeforeProtoProtocStyleTest",
"protoc_plugin._split_definitions_test.SplitProtoMid2016ProtocStyleTest",
"protoc_plugin._split_definitions_test.SplitProtoProtoBeforeGrpcProtocStyleTest",
"protoc_plugin._split_definitions_test.SplitProtoSingleProtocExecutionProtocStyleTest",
"protoc_plugin.beta_python_plugin_test.PythonPluginTest",
"reflection._reflection_client_test.ReflectionClientTest",
"reflection._reflection_servicer_test.ReflectionServicerTest",
"status._grpc_status_test.StatusTest",
"testing._client_test.ClientTest",
"testing._server_test.FirstServiceServicerTest",
"testing._time_test.StrictFakeTimeTest",
"testing._time_test.StrictRealTimeTest",
"unit._abort_test.AbortTest",
"unit._api_test.AllTest",
"unit._api_test.ChannelConnectivityTest",
"unit._api_test.ChannelTest",
"unit._auth_context_test.AuthContextTest",
"unit._auth_test.AccessTokenAuthMetadataPluginTest",
"unit._auth_test.GoogleCallCredentialsTest",
"unit._channel_args_test.ChannelArgsTest",
"unit._channel_close_test.ChannelCloseTest",
"unit._channel_connectivity_test.ChannelConnectivityTest",
"unit._channel_ready_future_test.ChannelReadyFutureTest",
"unit._compression_test.CompressionTest",
"unit._contextvars_propagation_test.ContextVarsPropagationTest",
"unit._credentials_test.CredentialsTest",
"unit._cython._cancel_many_calls_test.CancelManyCallsTest",
"unit._cython._channel_test.ChannelTest",
"unit._cython._fork_test.ForkPosixTester",
"unit._cython._fork_test.ForkWindowsTester",
"unit._cython._no_messages_server_completion_queue_per_call_test.Test",
"unit._cython._no_messages_single_server_completion_queue_test.Test",
"unit._cython._read_some_but_not_all_responses_test.ReadSomeButNotAllResponsesTest",
"unit._cython._server_test.Test",
"unit._cython.cygrpc_test.InsecureServerInsecureClient",
"unit._cython.cygrpc_test.SecureServerSecureClient",
"unit._cython.cygrpc_test.TypeSmokeTest",
"unit._dns_resolver_test.DNSResolverTest",
"unit._dynamic_stubs_test.DynamicStubTest",
"unit._empty_message_test.EmptyMessageTest",
"unit._error_message_encoding_test.ErrorMessageEncodingTest",
"unit._exit_test.ExitTest",
"unit._grpc_shutdown_test.GrpcShutdownTest",
"unit._interceptor_test.InterceptorTest",
"unit._invalid_metadata_test.InvalidMetadataTest",
"unit._invocation_defects_test.InvocationDefectsTest",
"unit._local_credentials_test.LocalCredentialsTest",
"unit._logging_test.LoggingTest",
"unit._metadata_code_details_test.InspectContextTest",
"unit._metadata_code_details_test.MetadataCodeDetailsTest",
"unit._metadata_flags_test.MetadataFlagsTest",
"unit._metadata_test.MetadataTest",
"unit._reconnect_test.ReconnectTest",
"unit._resource_exhausted_test.ResourceExhaustedTest",
"unit._rpc_part_1_test.RPCPart1Test",
"unit._rpc_part_2_test.RPCPart2Test",
"unit._server_shutdown_test.ServerShutdown",
"unit._server_ssl_cert_config_test.ServerSSLCertConfigFetcherParamsChecks",
"unit._server_ssl_cert_config_test.ServerSSLCertReloadTestCertConfigReuse",
"unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth",
"unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth",
"unit._server_test.ServerTest",
"unit._server_wait_for_termination_test.ServerWaitForTerminationTest",
"unit._session_cache_test.SSLSessionCacheTest",
"unit._signal_handling_test.SignalHandlingTest",
"unit._version_test.VersionTest",
"unit._xds_credentials_test.XdsCredentialsTest",
"unit.beta._beta_features_test.BetaFeaturesTest",
"unit.beta._beta_features_test.ContextManagementAndLifecycleTest",
"unit.beta._connectivity_channel_test.ConnectivityStatesTest",
"unit.beta._implementations_test.CallCredentialsTest",
"unit.beta._implementations_test.ChannelCredentialsTest",
"unit.beta._not_found_test.NotFoundTest",
"unit.beta._utilities_test.ChannelConnectivityTest",
"unit.framework.foundation._logging_pool_test.LoggingPoolTest"
"tests._sanity._sanity_test.SanityTest",
"tests.admin.admin_test.TestAdmin",
"tests.channelz._channelz_servicer_test.ChannelzServicerTest",
"tests.csds.csds_test.TestCsds",
"tests.csds.csds_test.TestCsdsStream",
"tests.fork._fork_interop_test.ForkInteropTest",
"tests.health_check._health_servicer_test.HealthServicerBackwardsCompatibleWatchTest",
"tests.health_check._health_servicer_test.HealthServicerTest",
"tests.interop._insecure_intraop_test.InsecureIntraopTest",
"tests.interop._secure_intraop_test.SecureIntraopTest",
"tests.protoc_plugin._python_plugin_test.ModuleMainTest",
"tests.protoc_plugin._python_plugin_test.PythonPluginTest",
"tests.protoc_plugin._python_plugin_test.SimpleStubsPluginTest",
"tests.protoc_plugin._split_definitions_test.SameProtoGrpcBeforeProtoProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SameProtoMid2016ProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SameProtoProtoBeforeGrpcProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SameProtoSingleProtocExecutionProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SplitProtoGrpcBeforeProtoProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SplitProtoMid2016ProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SplitProtoProtoBeforeGrpcProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.SplitProtoSingleProtocExecutionProtocStyleTest",
"tests.protoc_plugin._split_definitions_test.WellKnownTypesTest",
"tests.protoc_plugin.beta_python_plugin_test.PythonPluginTest",
"tests.reflection._reflection_client_test.ReflectionClientTest",
"tests.reflection._reflection_servicer_test.ReflectionServicerTest",
"tests.status._grpc_status_test.StatusTest",
"tests.testing._client_test.ClientTest",
"tests.testing._server_test.FirstServiceServicerTest",
"tests.testing._time_test.StrictFakeTimeTest",
"tests.testing._time_test.StrictRealTimeTest",
"tests.unit._abort_test.AbortTest",
"tests.unit._api_test.AllTest",
"tests.unit._api_test.ChannelConnectivityTest",
"tests.unit._api_test.ChannelTest",
"tests.unit._auth_context_test.AuthContextTest",
"tests.unit._auth_test.AccessTokenAuthMetadataPluginTest",
"tests.unit._auth_test.GoogleCallCredentialsTest",
"tests.unit._channel_args_test.ChannelArgsTest",
"tests.unit._channel_close_test.ChannelCloseTest",
"tests.unit._channel_connectivity_test.ChannelConnectivityTest",
"tests.unit._channel_ready_future_test.ChannelReadyFutureTest",
"tests.unit._compression_test.CompressionTest",
"tests.unit._contextvars_propagation_test.ContextVarsPropagationTest",
"tests.unit._credentials_test.CredentialsTest",
"tests.unit._cython._cancel_many_calls_test.CancelManyCallsTest",
"tests.unit._cython._channel_test.ChannelTest",
"tests.unit._cython._fork_test.ForkPosixTester",
"tests.unit._cython._fork_test.ForkWindowsTester",
"tests.unit._cython._no_messages_server_completion_queue_per_call_test.Test",
"tests.unit._cython._no_messages_single_server_completion_queue_test.Test",
"tests.unit._cython._read_some_but_not_all_responses_test.ReadSomeButNotAllResponsesTest",
"tests.unit._cython._server_test.Test",
"tests.unit._cython.cygrpc_test.InsecureServerInsecureClient",
"tests.unit._cython.cygrpc_test.SecureServerSecureClient",
"tests.unit._cython.cygrpc_test.TypeSmokeTest",
"tests.unit._dns_resolver_test.DNSResolverTest",
"tests.unit._dynamic_stubs_test.DynamicStubTest",
"tests.unit._empty_message_test.EmptyMessageTest",
"tests.unit._error_message_encoding_test.ErrorMessageEncodingTest",
"tests.unit._exit_test.ExitTest",
"tests.unit._grpc_shutdown_test.GrpcShutdownTest",
"tests.unit._interceptor_test.InterceptorTest",
"tests.unit._invalid_metadata_test.InvalidMetadataTest",
"tests.unit._invocation_defects_test.InvocationDefectsTest",
"tests.unit._local_credentials_test.LocalCredentialsTest",
"tests.unit._logging_test.LoggingTest",
"tests.unit._metadata_code_details_test.InspectContextTest",
"tests.unit._metadata_code_details_test.MetadataCodeDetailsTest",
"tests.unit._metadata_flags_test.MetadataFlagsTest",
"tests.unit._metadata_test.MetadataTest",
"tests.unit._reconnect_test.ReconnectTest",
"tests.unit._resource_exhausted_test.ResourceExhaustedTest",
"tests.unit._rpc_part_1_test.RPCPart1Test",
"tests.unit._rpc_part_2_test.RPCPart2Test",
"tests.unit._server_shutdown_test.ServerShutdown",
"tests.unit._server_ssl_cert_config_test.ServerSSLCertConfigFetcherParamsChecks",
"tests.unit._server_ssl_cert_config_test.ServerSSLCertReloadTestCertConfigReuse",
"tests.unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithClientAuth",
"tests.unit._server_ssl_cert_config_test.ServerSSLCertReloadTestWithoutClientAuth",
"tests.unit._server_test.ServerTest",
"tests.unit._server_wait_for_termination_test.ServerWaitForTerminationTest",
"tests.unit._session_cache_test.SSLSessionCacheTest",
"tests.unit._signal_handling_test.SignalHandlingTest",
"tests.unit._version_test.VersionTest",
"tests.unit._xds_credentials_test.XdsCredentialsTest",
"tests.unit.beta._beta_features_test.BetaFeaturesTest",
"tests.unit.beta._beta_features_test.ContextManagementAndLifecycleTest",
"tests.unit.beta._connectivity_channel_test.ConnectivityStatesTest",
"tests.unit.beta._implementations_test.CallCredentialsTest",
"tests.unit.beta._implementations_test.ChannelCredentialsTest",
"tests.unit.beta._not_found_test.NotFoundTest",
"tests.unit.beta._utilities_test.ChannelConnectivityTest",
"tests.unit.framework.foundation._logging_pool_test.LoggingPoolTest"
]

@ -131,8 +131,11 @@ def _test_grpc_tools_unimportable():
# NOTE(rbellevi): multiprocessing.Process fails to pickle function objects
# when they do not come from the "__main__" module, so this test passes
# if run directly on Windows, but not if started by the test runner.
@unittest.skipIf(os.name == "nt", "Windows multiprocessing unsupported")
# if run directly on Windows or MacOS, but not if started by the test runner.
@unittest.skipIf(
os.name == "nt" or "darwin" in sys.platform,
"Windows and MacOS multiprocessing unsupported",
)
class DynamicStubTest(unittest.TestCase):
def test_sunny_day(self):
_run_in_subprocess(_test_sunny_day)

@ -1,44 +1,44 @@
[
"_sanity._sanity_test.AioSanityTest",
"channelz.channelz_servicer_test.ChannelzServicerTest",
"health_check.health_servicer_test.HealthServicerTest",
"interop.local_interop_test.InsecureLocalInteropTest",
"interop.local_interop_test.SecureLocalInteropTest",
"reflection.reflection_servicer_test.ReflectionServicerTest",
"status.grpc_status_test.StatusTest",
"unit._metadata_test.TestTypeMetadata",
"unit.abort_test.TestAbort",
"unit.aio_rpc_error_test.TestAioRpcError",
"unit.auth_context_test.TestAuthContext",
"unit.call_test.TestStreamStreamCall",
"unit.call_test.TestStreamUnaryCall",
"unit.call_test.TestUnaryStreamCall",
"unit.call_test.TestUnaryUnaryCall",
"unit.channel_argument_test.TestChannelArgument",
"unit.channel_ready_test.TestChannelReady",
"unit.channel_test.TestChannel",
"unit.client_stream_stream_interceptor_test.TestStreamStreamClientInterceptor",
"unit.client_stream_unary_interceptor_test.TestStreamUnaryClientInterceptor",
"unit.client_unary_stream_interceptor_test.TestUnaryStreamClientInterceptor",
"unit.client_unary_unary_interceptor_test.TestInterceptedUnaryUnaryCall",
"unit.client_unary_unary_interceptor_test.TestUnaryUnaryClientInterceptor",
"unit.close_channel_test.TestCloseChannel",
"unit.compatibility_test.TestCompatibility",
"unit.compression_test.TestCompression",
"unit.connectivity_test.TestConnectivityState",
"unit.context_peer_test.TestContextPeer",
"unit.done_callback_test.TestClientSideDoneCallback",
"unit.done_callback_test.TestServerSideDoneCallback",
"unit.init_test.TestInit",
"unit.metadata_test.TestMetadata",
"unit.outside_init_test.TestOutsideInit",
"unit.secure_call_test.TestStreamStreamSecureCall",
"unit.secure_call_test.TestUnaryStreamSecureCall",
"unit.secure_call_test.TestUnaryUnarySecureCall",
"unit.server_interceptor_test.TestServerInterceptor",
"unit.server_test.TestServer",
"unit.server_time_remaining_test.TestServerTimeRemaining",
"unit.timeout_test.TestTimeout",
"unit.wait_for_connection_test.TestWaitForConnection",
"unit.wait_for_ready_test.TestWaitForReady"
"tests_aio._sanity._sanity_test.AioSanityTest",
"tests_aio.channelz.channelz_servicer_test.ChannelzServicerTest",
"tests_aio.health_check.health_servicer_test.HealthServicerTest",
"tests_aio.interop.local_interop_test.InsecureLocalInteropTest",
"tests_aio.interop.local_interop_test.SecureLocalInteropTest",
"tests_aio.reflection.reflection_servicer_test.ReflectionServicerTest",
"tests_aio.status.grpc_status_test.StatusTest",
"tests_aio.unit._metadata_test.TestTypeMetadata",
"tests_aio.unit.abort_test.TestAbort",
"tests_aio.unit.aio_rpc_error_test.TestAioRpcError",
"tests_aio.unit.auth_context_test.TestAuthContext",
"tests_aio.unit.call_test.TestStreamStreamCall",
"tests_aio.unit.call_test.TestStreamUnaryCall",
"tests_aio.unit.call_test.TestUnaryStreamCall",
"tests_aio.unit.call_test.TestUnaryUnaryCall",
"tests_aio.unit.channel_argument_test.TestChannelArgument",
"tests_aio.unit.channel_ready_test.TestChannelReady",
"tests_aio.unit.channel_test.TestChannel",
"tests_aio.unit.client_stream_stream_interceptor_test.TestStreamStreamClientInterceptor",
"tests_aio.unit.client_stream_unary_interceptor_test.TestStreamUnaryClientInterceptor",
"tests_aio.unit.client_unary_stream_interceptor_test.TestUnaryStreamClientInterceptor",
"tests_aio.unit.client_unary_unary_interceptor_test.TestInterceptedUnaryUnaryCall",
"tests_aio.unit.client_unary_unary_interceptor_test.TestUnaryUnaryClientInterceptor",
"tests_aio.unit.close_channel_test.TestCloseChannel",
"tests_aio.unit.compatibility_test.TestCompatibility",
"tests_aio.unit.compression_test.TestCompression",
"tests_aio.unit.connectivity_test.TestConnectivityState",
"tests_aio.unit.context_peer_test.TestContextPeer",
"tests_aio.unit.done_callback_test.TestClientSideDoneCallback",
"tests_aio.unit.done_callback_test.TestServerSideDoneCallback",
"tests_aio.unit.init_test.TestInit",
"tests_aio.unit.metadata_test.TestMetadata",
"tests_aio.unit.outside_init_test.TestOutsideInit",
"tests_aio.unit.secure_call_test.TestStreamStreamSecureCall",
"tests_aio.unit.secure_call_test.TestUnaryStreamSecureCall",
"tests_aio.unit.secure_call_test.TestUnaryUnarySecureCall",
"tests_aio.unit.server_interceptor_test.TestServerInterceptor",
"tests_aio.unit.server_test.TestServer",
"tests_aio.unit.server_time_remaining_test.TestServerTimeRemaining",
"tests_aio.unit.timeout_test.TestTimeout",
"tests_aio.unit.wait_for_connection_test.TestWaitForConnection",
"tests_aio.unit.wait_for_ready_test.TestWaitForReady"
]

@ -183,9 +183,9 @@ class _TestGenericHandlerForMethods(grpc.GenericRpcHandler):
context.set_trailing_metadata(_TRAILING_METADATA)
# ensure that we can read back the data we set on the context
assert context.get_code() == _NON_OK_CODE
assert context.get_details() == _DETAILS
assert context.get_trailing_metadata() == _TRAILING_METADATA
assert context.code() == _NON_OK_CODE
assert context.details() == _DETAILS
assert context.trailing_metadata() == _TRAILING_METADATA
return _RESPONSE
def service(self, handler_call_details):

@ -570,6 +570,9 @@ class TestServer(AioTestBase):
server.add_secure_port(bind_address, server_credentials)
async def test_maximum_concurrent_rpcs(self):
async def coro_wrapper(awaitable):
return await awaitable
# Build the server with concurrent rpc argument
server = aio.server(maximum_concurrent_rpcs=_MAXIMUM_CONCURRENT_RPCS)
port = server.add_insecure_port("localhost:0")
@ -579,15 +582,18 @@ class TestServer(AioTestBase):
# Build the channel
channel = aio.insecure_channel(bind_address)
# Deplete the concurrent quota with 3 times of max RPCs
rpcs = []
rpc_tasks = []
for _ in range(3 * _MAXIMUM_CONCURRENT_RPCS):
rpcs.append(channel.unary_unary(_BLOCK_BRIEFLY)(_REQUEST))
task = self.loop.create_task(
asyncio.wait(rpcs, return_when=asyncio.FIRST_EXCEPTION)
task = asyncio.create_task(
coro_wrapper(channel.unary_unary(_BLOCK_BRIEFLY)(_REQUEST))
)
rpc_tasks.append(task)
await_tasks = asyncio.wait(
rpc_tasks, return_when=asyncio.FIRST_EXCEPTION
)
# Each batch took test_constants.SHORT_TIMEOUT /2
start_time = time.time()
await task
await await_tasks
elapsed_time = time.time() - start_time
self.assertGreater(elapsed_time, test_constants.SHORT_TIMEOUT * 3 / 2)
# Clean-up

@ -1 +0,0 @@
["unit.close_channel_test.CloseChannelTest"]

@ -1,7 +1,7 @@
#=================
# Compile CPython 3.10.3 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && ${'\\'}

@ -1,7 +1,7 @@
#=================
# Compile CPython 3.11.4 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && ${'\\'}

@ -1,7 +1,7 @@
#=================
# Compile CPython 3.7.13 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && ${'\\'}

@ -1,7 +1,7 @@
#=================
# Compile CPython 3.8.13 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && ${'\\'}

@ -19,6 +19,10 @@
<%include file="../../apt_get_basic.include"/>
<%include file="../../run_tests_addons.include"/>
# Python test coverage requires libsqlite3, and it have
# to be installed before Python.
RUN apt-get update && apt-get install -y libsqlite3-dev
# 3.9 is the default python3 version on debian11
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip

@ -25,6 +25,10 @@
<%include file="../../compile_python_310.include"/>
<%include file="../../compile_python_311.include"/>
# Python test coverage requires libsqlite3, and it have
# to be installed before Python.
RUN apt-get update && apt-get install -y libsqlite3-dev
# 3.9 is the default python3 version on debian11
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip

@ -107,8 +107,8 @@ DOCKERIMAGE_CURRENT_VERSIONS = {
"tools/dockerfile/test/php7_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian11_arm64@sha256:7ee21f253a2ddd255f4f6779cd19818eec6524e78b0bf0a7765339e4aa7347c3",
"tools/dockerfile/test/php7_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/php7_debian11_x64@sha256:302c06c5dbffb97dd5540d758a8ce849269527bb7d1c3885af0b956f8f33c49e",
"tools/dockerfile/test/python_alpine_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_alpine_x64@sha256:75fa424f2dae683422a5875d64911d9abf06c31e944401d240666d06f83de573",
"tools/dockerfile/test/python_debian11_default_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64@sha256:e1fd0a85aed633d817ac086f3c588c6343d316b7d41a4dd62a8ecfbb70358687",
"tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:8f22ba10b93b14c13ceb296cbbd41dba04947b457efc229412b43280ad6a4adc",
"tools/dockerfile/test/python_debian11_default_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64@sha256:fccca33a655c7aa89dd7ebd9492cbcc1f636bd2a004cd939d1982cfce3d68326",
"tools/dockerfile/test/python_debian11_default_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64@sha256:51107bfe5f9ef2c9d9c7a6554a16c4335a6d48f81a47cf6176fb36eca0605f02",
"tools/dockerfile/test/rbe_ubuntu2004.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/rbe_ubuntu2004@sha256:d3951aeadf43e3bee6adc5b86d26cdaf0b9d1b5baf790d7b2530d1c197adc9f8",
"tools/dockerfile/test/ruby_debian11_arm64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_arm64@sha256:7e77cf17e2e8657f4cc23ac9f93630bf13213fff961799e0f16dae17cd45cf6d",
"tools/dockerfile/test/ruby_debian11_x64.current_version": "docker://us-docker.pkg.dev/grpc-testing/testing-images-public/ruby_debian11_x64@sha256:e4cb502caccf2db733268ce2ddc951fda8a9df2f7f53d6b74523c33d40c83006",

@ -101,7 +101,7 @@ COMPILE_BOTH = COMPILE_PROTO_ONLY + ["--grpc_python_out={}".format(OUTPUT_PATH)]
def has_grpc_service(proto_package_path: str) -> bool:
return proto_package_path.startswith("envoy/service")
return proto_package_path.startswith(os.path.join("envoy", "service"))
def compile_protos(proto_root: str, sub_dir: str = ".") -> None:

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64:4fbecbb42c07bce5d982e3808be6981549a5126d@sha256:e1fd0a85aed633d817ac086f3c588c6343d316b7d41a4dd62a8ecfbb70358687
us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_arm64:55eb2e98cc7ff914777976a5482fee5fa62e9cbe@sha256:fccca33a655c7aa89dd7ebd9492cbcc1f636bd2a004cd939d1982cfce3d68326

@ -66,6 +66,10 @@ RUN git config --global protocol.file.allow always
RUN mkdir /var/local/jenkins
# Python test coverage requires libsqlite3, and it have
# to be installed before Python.
RUN apt-get update && apt-get install -y libsqlite3-dev
# 3.9 is the default python3 version on debian11
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip

@ -1 +1 @@
us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:a6300ecdbf62f0873270a97068c013e4ffc0b32d@sha256:8f22ba10b93b14c13ceb296cbbd41dba04947b457efc229412b43280ad6a4adc
us-docker.pkg.dev/grpc-testing/testing-images-public/python_debian11_default_x64:3aec01d65a59f4583b9a54369fc5d08b84b1017e@sha256:51107bfe5f9ef2c9d9c7a6554a16c4335a6d48f81a47cf6176fb36eca0605f02

@ -90,7 +90,7 @@ RUN python3.6 -m ensurepip && \
#=================
# Compile CPython 3.7.13 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && \
@ -111,7 +111,7 @@ RUN python3.7 -m ensurepip && \
#=================
# Compile CPython 3.8.13 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && \
@ -132,7 +132,7 @@ RUN python3.8 -m ensurepip && \
#=================
# Compile CPython 3.10.3 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && \
@ -153,7 +153,7 @@ RUN python3.10 -m ensurepip && \
#=================
# Compile CPython 3.11.4 from source
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev && apt-get clean
RUN apt-get update && apt-get install -y zlib1g-dev libssl-dev libsqlite3-dev && apt-get clean
RUN apt-get update && apt-get install -y jq build-essential libffi-dev && apt-get clean
RUN cd /tmp && \
@ -173,6 +173,10 @@ RUN python3.11 -m ensurepip && \
python3.11 -m pip install coverage
# Python test coverage requires libsqlite3, and it have
# to be installed before Python.
RUN apt-get update && apt-get install -y libsqlite3-dev
# 3.9 is the default python3 version on debian11
RUN apt-get update && apt-get install -y python3.9 python3.9-dev python3-pip

@ -234,7 +234,7 @@ then
# through setup.py, but we can optimize it with "bdist_wheel" command, which
# skips the wheel building step.
# Build grpcio_reflection source distribution
# Build xds_protos source distribution
${SETARCH_CMD} "${PYTHON}" tools/distrib/python/xds_protos/build.py
${SETARCH_CMD} "${PYTHON}" tools/distrib/python/xds_protos/setup.py \
sdist bdist_wheel install

@ -211,7 +211,7 @@ pip_install_dir "$ROOT/src/python/grpcio_admin"
pip_install_dir "$ROOT/src/python/grpcio_testing"
# Build/install tests
pip_install coverage==4.4 oauth2client==4.1.0 \
pip_install coverage==7.2.0 oauth2client==4.1.0 \
google-auth>=1.35.0 requests==2.31.0 \
googleapis-common-protos>=1.5.5 rsa==4.0 absl-py==1.4.0
$VENV_PYTHON "$ROOT/src/python/grpcio_tests/setup.py" preprocess

@ -721,16 +721,11 @@ class PythonConfig(
class PythonLanguage(object):
_TEST_SPECS_FILE = {
"native": ["src/python/grpcio_tests/tests/tests.json"],
"gevent": [
"src/python/grpcio_tests/tests/tests.json",
"src/python/grpcio_tests/tests_gevent/tests.json",
],
"asyncio": ["src/python/grpcio_tests/tests_aio/tests.json"],
}
_TEST_COMMAND = {
"native": "test_lite",
"gevent": "test_gevent",
"asyncio": "test_aio",
}
@ -755,7 +750,7 @@ class PythonLanguage(object):
],
timeout_seconds=60,
environ=_FORCE_ENVIRON_FOR_WRAPPERS,
shortname="f{python_config.name}.xds_protos",
shortname=f"{python_config.name}.xds_protos",
)
)

Loading…
Cancel
Save