From c9ce403dc46e494e8ae546c4e99e044dbdda5400 Mon Sep 17 00:00:00 2001 From: Richard Belleville Date: Tue, 2 Jul 2019 14:00:46 -0700 Subject: [PATCH] Ensure bazel_hack terminates when running test_gevent. --- .../grpcio_tests/tests/bazel_namespace_package_hack.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/python/grpcio_tests/tests/bazel_namespace_package_hack.py b/src/python/grpcio_tests/tests/bazel_namespace_package_hack.py index c6b72c327b1..0250dce0d61 100644 --- a/src/python/grpcio_tests/tests/bazel_namespace_package_hack.py +++ b/src/python/grpcio_tests/tests/bazel_namespace_package_hack.py @@ -24,9 +24,15 @@ import sys # Analysis in depth: https://github.com/bazelbuild/rules_python/issues/55 def sys_path_to_site_dir_hack(): """Add valid sys.path item to site directory to parse the .pth files.""" + print("Executing hack") + print("sys.path: {}".format(sys.path)) + items = [] for item in sys.path: + print("Checking {}".format(item)) if os.path.exists(item): # The only difference between sys.path and site-directory is # whether the .pth file will be parsed or not. A site-directory # will always exist in sys.path, but not another way around. - site.addsitedir(item) + items.append(item) + for item in items: + site.addsitedir(item)