Run tests under setup.py

pull/21458/head
Richard Belleville 5 years ago
parent 6055bc564d
commit d4e8d9956c
  1. 1
      src/python/grpcio_tests/tests/tests.json
  2. 1
      src/python/grpcio_tests/tests/unit/BUILD.bazel
  3. 8
      src/python/grpcio_tests/tests/unit/_dynamic_stubs_test.py
  4. 7
      tools/distrib/python/grpcio_tools/_parallel_compile_patch.py
  5. 5
      tools/distrib/python/grpcio_tools/grpc_tools/test/protoc_test.py

@ -49,6 +49,7 @@
"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",

@ -112,7 +112,6 @@ py_library(
for test_file_name in GRPCIO_TESTS_UNIT
]
# TODO: Somehow incorporate into setup.py workflow.
py2and3_test(
name = "_dynamic_stubs_test",
size = "small",

@ -27,6 +27,14 @@ import functools
def _grpc_tools_unimportable():
original_sys_path = sys.path
sys.path = [path for path in sys.path if "grpcio_tools" not in path]
try:
import grpc_tools
except ImportError:
pass
else:
del grpc_tools
sys.path = original_sys_path
raise unittest.SkipTest("Failed to make grpc_tools unimportable.")
try:
yield
finally:

@ -22,9 +22,10 @@ import os
try:
BUILD_EXT_COMPILER_JOBS = int(
os.environ.get('GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS', '1'))
except ValueError:
BUILD_EXT_COMPILER_JOBS = 1
os.environ.get('GRPC_PYTHON_BUILD_EXT_COMPILER_JOBS'))
except KeyError:
import multiprocessing
BUILD_EXT_COMPILER_JOBS = multiprocessing.cpu_count()
# monkey-patch for parallel compilation

@ -109,9 +109,6 @@ def _test_syntax_errors():
assert False, "Compile error expected. None occurred."
# TODO: Test warnings.
class ProtocTest(unittest.TestCase):
def test_import_protos(self):
@ -138,8 +135,6 @@ class ProtocTest(unittest.TestCase):
def test_syntax_errors(self):
_run_in_subprocess(_test_syntax_errors)
# TODO: Write test to ensure the right module loader is used.
if __name__ == '__main__':
unittest.main()

Loading…
Cancel
Save