3a226ae
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
3a226ae
index 492a84a2313..9746678607c 100644
3a226ae
--- a/Lib/test/test_asyncio/test_events.py
3a226ae
+++ b/Lib/test/test_asyncio/test_events.py
3a226ae
@@ -1980,19 +1980,26 @@ def test_subprocess_terminate(self):
3a226ae
 
3a226ae
     @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
3a226ae
     def test_subprocess_send_signal(self):
3a226ae
-        prog = os.path.join(os.path.dirname(__file__), 'echo.py')
3a226ae
-
3a226ae
-        connect = self.loop.subprocess_exec(
3a226ae
-                        functools.partial(MySubprocessProtocol, self.loop),
3a226ae
-                        sys.executable, prog)
3a226ae
-        transp, proto = self.loop.run_until_complete(connect)
3a226ae
-        self.assertIsInstance(proto, MySubprocessProtocol)
3a226ae
-        self.loop.run_until_complete(proto.connected)
3a226ae
-
3a226ae
-        transp.send_signal(signal.SIGHUP)
3a226ae
-        self.loop.run_until_complete(proto.completed)
3a226ae
-        self.assertEqual(-signal.SIGHUP, proto.returncode)
3a226ae
-        transp.close()
3a226ae
+        # bpo-31034: Make sure that we get the default signal handler (killing
3a226ae
+        # the process). The parent process may have decided to ignore SIGHUP,
3a226ae
+        # and signal handlers are inherited.
3a226ae
+        old_handler = signal.signal(signal.SIGHUP, signal.SIG_DFL)
3a226ae
+        try:
3a226ae
+            prog = os.path.join(os.path.dirname(__file__), 'echo.py')
3a226ae
+
3a226ae
+            connect = self.loop.subprocess_exec(
3a226ae
+                            functools.partial(MySubprocessProtocol, self.loop),
3a226ae
+                            sys.executable, prog)
3a226ae
+            transp, proto = self.loop.run_until_complete(connect)
3a226ae
+            self.assertIsInstance(proto, MySubprocessProtocol)
3a226ae
+            self.loop.run_until_complete(proto.connected)
3a226ae
+
3a226ae
+            transp.send_signal(signal.SIGHUP)
3a226ae
+            self.loop.run_until_complete(proto.completed)
3a226ae
+            self.assertEqual(-signal.SIGHUP, proto.returncode)
3a226ae
+            transp.close()
3a226ae
+        finally:
3a226ae
+            signal.signal(signal.SIGHUP, old_handler)
3a226ae
 
3a226ae
     def test_subprocess_stderr(self):
3a226ae
         prog = os.path.join(os.path.dirname(__file__), 'echo2.py')
3a226ae
diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py
3a226ae
index 2e14a8a9735..e8822c36698 100644
3a226ae
--- a/Lib/test/test_asyncio/test_subprocess.py
3a226ae
+++ b/Lib/test/test_asyncio/test_subprocess.py
3a226ae
@@ -166,25 +166,32 @@ def test_terminate(self):
3a226ae
 
3a226ae
     @unittest.skipIf(sys.platform == 'win32', "Don't have SIGHUP")
3a226ae
     def test_send_signal(self):
3a226ae
-        code = 'import time; print("sleeping", flush=True); time.sleep(3600)'
3a226ae
-        args = [sys.executable, '-c', code]
3a226ae
-        create = asyncio.create_subprocess_exec(*args,
3a226ae
-                                                stdout=subprocess.PIPE,
3a226ae
-                                                loop=self.loop)
3a226ae
-        proc = self.loop.run_until_complete(create)
3a226ae
-
3a226ae
-        @asyncio.coroutine
3a226ae
-        def send_signal(proc):
3a226ae
-            # basic synchronization to wait until the program is sleeping
3a226ae
-            line = yield from proc.stdout.readline()
3a226ae
-            self.assertEqual(line, b'sleeping\n')
3a226ae
+        # bpo-31034: Make sure that we get the default signal handler (killing
3a226ae
+        # the process). The parent process may have decided to ignore SIGHUP,
3a226ae
+        # and signal handlers are inherited.
3a226ae
+        old_handler = signal.signal(signal.SIGHUP, signal.SIG_DFL)
3a226ae
+        try:
3a226ae
+            code = 'import time; print("sleeping", flush=True); time.sleep(3600)'
3a226ae
+            args = [sys.executable, '-c', code]
3a226ae
+            create = asyncio.create_subprocess_exec(*args,
3a226ae
+                                                    stdout=subprocess.PIPE,
3a226ae
+                                                    loop=self.loop)
3a226ae
+            proc = self.loop.run_until_complete(create)
3a226ae
 
3a226ae
-            proc.send_signal(signal.SIGHUP)
3a226ae
-            returncode = (yield from proc.wait())
3a226ae
-            return returncode
3a226ae
-
3a226ae
-        returncode = self.loop.run_until_complete(send_signal(proc))
3a226ae
-        self.assertEqual(-signal.SIGHUP, returncode)
3a226ae
+            @asyncio.coroutine
3a226ae
+            def send_signal(proc):
3a226ae
+                # basic synchronization to wait until the program is sleeping
3a226ae
+                line = yield from proc.stdout.readline()
3a226ae
+                self.assertEqual(line, b'sleeping\n')
3a226ae
+
3a226ae
+                proc.send_signal(signal.SIGHUP)
3a226ae
+                returncode = (yield from proc.wait())
3a226ae
+                return returncode
3a226ae
+
3a226ae
+            returncode = self.loop.run_until_complete(send_signal(proc))
3a226ae
+            self.assertEqual(-signal.SIGHUP, returncode)
3a226ae
+        finally:
3a226ae
+            signal.signal(signal.SIGHUP, old_handler)
3a226ae
 
3a226ae
     def prepare_broken_pipe_test(self):
3a226ae
         # buffer large enough to feed the whole pipe buffer