Преглед на файлове

Don't run test under Python 2

Richard Belleville преди 5 години
родител
ревизия
20f85c1d60

+ 1 - 1
src/python/grpcio_tests/tests/unit/BUILD.bazel

@@ -32,7 +32,6 @@ GRPCIO_TESTS_UNIT = [
     "_resource_exhausted_test.py",
     "_rpc_test.py",
     "_signal_handling_test.py",
-    "_simple_stubs_test.py",
     # TODO(ghostwriternr): To be added later.
     # "_server_ssl_cert_config_test.py",
     "_server_test.py",
@@ -111,3 +110,4 @@ py_library(
     )
     for test_file_name in GRPCIO_TESTS_UNIT
 ]
+

+ 28 - 0
src/python/grpcio_tests/tests/unit/py3_only/BUILD.bazel

@@ -0,0 +1,28 @@
+package(
+  default_visibility = ["//visibility:public"],
+  default_testonly = True,
+)
+
+GRPCIO_PY3_ONLY_UNIT_TESTS = [
+    "_simple_stubs_test.py",
+]
+
+[
+  py_test(
+    name = test_file_name[:-len(".py")],
+    size = "small",
+    python_version = "PY3",
+    srcs_version = "PY3",
+    srcs = [test_file_name],
+    main = test_file_name,
+    deps = [
+        "//src/python/grpcio_tests/tests/unit:resources",
+        "//src/python/grpcio_tests/tests/unit:test_common",
+        "//src/python/grpcio/grpc:grpcio",
+        "//src/python/grpcio_tests/tests/testing",
+        "//src/python/grpcio_tests/tests/unit/framework/common",
+        "@six",
+    ],
+    imports = [".."],
+  ) for test_file_name in GRPCIO_PY3_ONLY_UNIT_TESTS
+]

+ 0 - 1
src/python/grpcio_tests/tests/unit/_simple_stubs_test.py → src/python/grpcio_tests/tests/unit/py3_only/_simple_stubs_test.py

@@ -28,7 +28,6 @@ os.environ["GRPC_PYTHON_MANAGED_CHANNEL_EVICTION_SECONDS"] = "1"
 import grpc
 import test_common
 
-# TODO: Figure out how to get this test to run only for Python 3.
 from typing import Callable, Optional
 
 _CACHE_EPOCHS = 8