Adopt reviewer's advices

pull/17644/head
Lidi Zheng 6 years ago
parent ee23fc3d2e
commit 7e90dad675
  1. 10
      src/python/grpcio_tests/tests/BUILD.bazel
  2. 2
      src/python/grpcio_tests/tests/bazel_namespace_package_hack.py
  3. 2
      src/python/grpcio_tests/tests/interop/BUILD.bazel
  4. 4
      src/python/grpcio_tests/tests/interop/methods.py
  5. 2
      src/python/grpcio_tests/tests/status/BUILD.bazel
  6. 4
      src/python/grpcio_tests/tests/status/_grpc_status_test.py

@ -1,8 +1,8 @@
py_library(
name = "bazel_patch",
srcs = ["bazel_patch.py"],
visibility = ["//visibility:public"],
data=[
"//src/python/grpcio_tests/tests/unit/credentials",
name = "bazel_namespace_package_hack",
srcs = ["bazel_namespace_package_hack.py"],
visibility = [
"//src/python/grpcio_tests/tests/status:__subpackages__",
"//src/python/grpcio_tests/tests/interop:__subpackages__",
],
)

@ -22,7 +22,7 @@ import sys
# Python process to parse the .pth file in the sys.path to resolve namespace
# package in the right place.
# Analysis in depth: https://github.com/bazelbuild/rules_python/issues/55
def bazel_patch():
def sys_path_to_site_dir_hack():
"""Add valid sys.path item to site directory to parse the .pth files."""
for item in sys.path:
if os.path.exists(item):

@ -29,7 +29,7 @@ py_library(
srcs = ["methods.py"],
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_tests/tests:bazel_patch",
"//src/python/grpcio_tests/tests:bazel_namespace_package_hack",
"//src/proto/grpc/testing:py_empty_proto",
"//src/proto/grpc/testing:py_messages_proto",
"//src/proto/grpc/testing:py_test_proto",

@ -13,8 +13,8 @@
# limitations under the License.
"""Implementations of interoperability test methods."""
from tests.bazel_patch import bazel_patch
bazel_patch()
from tests import bazel_namespace_package_hack
bazel_namespace_package_hack.sys_path_to_site_dir_hack()
import enum
import json

@ -10,7 +10,7 @@ py_test(
deps = [
"//src/python/grpcio/grpc:grpcio",
"//src/python/grpcio_status/grpc_status:grpc_status",
"//src/python/grpcio_tests/tests:bazel_patch",
"//src/python/grpcio_tests/tests:bazel_namespace_package_hack",
"//src/python/grpcio_tests/tests/unit:test_common",
"//src/python/grpcio_tests/tests/unit/framework/common:common",
requirement('protobuf'),

@ -13,8 +13,8 @@
# limitations under the License.
"""Tests of grpc_status."""
from tests.bazel_patch import bazel_patch
bazel_patch()
from tests import bazel_namespace_package_hack
bazel_namespace_package_hack.sys_path_to_site_dir_hack()
import unittest

Loading…
Cancel
Save