summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2014-04-23 15:38:36 (GMT)
committerGregory P. Smith <greg@krypto.org>2014-04-23 15:38:36 (GMT)
commitab2719f90431f989350d10bf266c1a51f8e14d16 (patch)
tree9cb1942307c24b993f4f2ebf444575e8895cf6e8
parent8894ef1783d7c27e4fcd5318458250406bd6a68c (diff)
downloadcpython-ab2719f90431f989350d10bf266c1a51f8e14d16.zip
cpython-ab2719f90431f989350d10bf266c1a51f8e14d16.tar.gz
cpython-ab2719f90431f989350d10bf266c1a51f8e14d16.tar.bz2
fix the test on windows which has different return codes from killed
children.
-rw-r--r--Lib/test/test_subprocess.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index c57b899..4c8d493 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -1077,17 +1077,22 @@ class ProcessTestCase(BaseTestCase):
t = threading.Timer(0.2, kill_proc_timer_thread)
t.start()
+ if mswindows:
+ expected_errorcode = 1
+ else:
+ # Should be -9 because of the proc.kill() from the thread.
+ expected_errorcode = -9
+
# Wait for the process to finish; the thread should kill it
# long before it finishes on its own. Supplying a timeout
# triggers a different code path for better coverage.
proc.wait(timeout=20)
- # Should be -9 because of the proc.kill() from the thread.
- self.assertEqual(proc.returncode, -9,
+ self.assertEqual(proc.returncode, expected_errorcode,
msg="unexpected result in wait from main thread")
# This should be a no-op with no change in returncode.
proc.wait()
- self.assertEqual(proc.returncode, -9,
+ self.assertEqual(proc.returncode, expected_errorcode,
msg="unexpected result in second main wait.")
t.join()
@@ -1096,8 +1101,8 @@ class ProcessTestCase(BaseTestCase):
# be set by the wrong thread that doesn't actually have it
# leading to an incorrect value.
self.assertEqual([('thread-start-poll-result', None),
- ('thread-after-kill-and-wait', -9),
- ('thread-after-second-wait', -9)],
+ ('thread-after-kill-and-wait', expected_errorcode),
+ ('thread-after-second-wait', expected_errorcode)],
results)
def test_issue8780(self):