aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/python/grpcio_tests
diff options
context:
space:
mode:
authorGravatar kpayson64 <kpayson@google.com>2016-07-08 16:02:49 -0700
committerGravatar GitHub <noreply@github.com>2016-07-08 16:02:49 -0700
commit8444f2f9aaee5bf4a596fc8fbbcb369868e593c0 (patch)
treef9d1c8cca694eaa3d2a49fc81bf5a6884d4022d8 /src/python/grpcio_tests
parentacb0207b63ddcdf45ea75c52f82dbd5423a6069f (diff)
parent3a9e6d9770c3c8fb86135a6afea4ef3514996a10 (diff)
Merge pull request #7195 from soltanmm/winfix
Fix Python interop unit-tests on Windows
Diffstat (limited to 'src/python/grpcio_tests')
-rw-r--r--src/python/grpcio_tests/tests/_runner.py20
-rw-r--r--src/python/grpcio_tests/tests/interop/_insecure_interop_test.py2
-rw-r--r--src/python/grpcio_tests/tests/interop/_secure_interop_test.py2
3 files changed, 14 insertions, 10 deletions
diff --git a/src/python/grpcio_tests/tests/_runner.py b/src/python/grpcio_tests/tests/_runner.py
index f0718573e2..926dcbe23a 100644
--- a/src/python/grpcio_tests/tests/_runner.py
+++ b/src/python/grpcio_tests/tests/_runner.py
@@ -30,7 +30,6 @@
from __future__ import absolute_import
import collections
-import fcntl
import multiprocessing
import os
import select
@@ -178,15 +177,20 @@ class Runner(object):
stderr_pipe.write_bypass(
'\ninterrupted stderr:\n{}\n'.format(stderr_pipe.output().decode()))
os._exit(1)
- signal.signal(signal.SIGINT, sigint_handler)
- signal.signal(signal.SIGSEGV, fault_handler)
- signal.signal(signal.SIGBUS, fault_handler)
- signal.signal(signal.SIGABRT, fault_handler)
- signal.signal(signal.SIGFPE, fault_handler)
- signal.signal(signal.SIGILL, fault_handler)
+ def try_set_handler(name, handler):
+ try:
+ signal.signal(getattr(signal, name), handler)
+ except AttributeError:
+ pass
+ try_set_handler('SIGINT', sigint_handler)
+ try_set_handler('SIGSEGV', fault_handler)
+ try_set_handler('SIGBUS', fault_handler)
+ try_set_handler('SIGABRT', fault_handler)
+ try_set_handler('SIGFPE', fault_handler)
+ try_set_handler('SIGILL', fault_handler)
# Sometimes output will lag after a test has successfully finished; we
# ignore such writes to our pipes.
- signal.signal(signal.SIGPIPE, signal.SIG_IGN)
+ try_set_handler('SIGPIPE', signal.SIG_IGN)
# Run the tests
result.startTestRun()
diff --git a/src/python/grpcio_tests/tests/interop/_insecure_interop_test.py b/src/python/grpcio_tests/tests/interop/_insecure_interop_test.py
index 91519b6fba..c753d6faf0 100644
--- a/src/python/grpcio_tests/tests/interop/_insecure_interop_test.py
+++ b/src/python/grpcio_tests/tests/interop/_insecure_interop_test.py
@@ -48,7 +48,7 @@ class InsecureInteropTest(
port = self.server.add_insecure_port('[::]:0')
self.server.start()
self.stub = test_pb2.beta_create_TestService_stub(
- implementations.insecure_channel('[::]', port))
+ implementations.insecure_channel('localhost', port))
def tearDown(self):
self.server.stop(0)
diff --git a/src/python/grpcio_tests/tests/interop/_secure_interop_test.py b/src/python/grpcio_tests/tests/interop/_secure_interop_test.py
index c61547b977..cb09f54a34 100644
--- a/src/python/grpcio_tests/tests/interop/_secure_interop_test.py
+++ b/src/python/grpcio_tests/tests/interop/_secure_interop_test.py
@@ -55,7 +55,7 @@ class SecureInteropTest(
self.server.start()
self.stub = test_pb2.beta_create_TestService_stub(
test_utilities.not_really_secure_channel(
- '[::]', port, implementations.ssl_channel_credentials(
+ 'localhost', port, implementations.ssl_channel_credentials(
resources.test_root_certificates()),
_SERVER_HOST_OVERRIDE))