summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorFlorent Xicluna <florent.xicluna@gmail.com>2010-03-04 21:31:58 (GMT)
committerFlorent Xicluna <florent.xicluna@gmail.com>2010-03-04 21:31:58 (GMT)
commitab5e17f8964bfb9b73566180e27410520d2391d4 (patch)
treee734e719d0eadbec7b5204dc3363544a4514328f /Lib
parentbab22a7c6d3c740fe839f5bcac9cee9f22fd28d3 (diff)
downloadcpython-ab5e17f8964bfb9b73566180e27410520d2391d4.zip
cpython-ab5e17f8964bfb9b73566180e27410520d2391d4.tar.gz
cpython-ab5e17f8964bfb9b73566180e27410520d2391d4.tar.bz2
#2777: Enable test_send_signal, test_kill and test_terminate on all platforms.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_subprocess.py26
1 files changed, 20 insertions, 6 deletions
diff --git a/Lib/test/test_subprocess.py b/Lib/test/test_subprocess.py
index 2d44fd9..1f3b09c 100644
--- a/Lib/test/test_subprocess.py
+++ b/Lib/test/test_subprocess.py
@@ -39,6 +39,12 @@ class ProcessTestCase(unittest.TestCase):
# doesn't crash on some buildbots (Alphas in particular).
test_support.reap_children()
+ def tearDown(self):
+ for inst in subprocess._active:
+ inst.wait()
+ subprocess._cleanup()
+ self.assertFalse(subprocess._active, "subprocess._active not empty")
+
def assertStderrEqual(self, stderr, expected, msg=None):
# In a debug build, stuff like "[6580 refs]" is printed to stderr at
# shutdown time. That frustrates tests trying to check stderr produced
@@ -559,6 +565,12 @@ class POSIXProcessTestCase(unittest.TestCase):
# doesn't crash on some buildbots (Alphas in particular).
test_support.reap_children()
+ def tearDown(self):
+ for inst in subprocess._active:
+ inst.wait()
+ subprocess._cleanup()
+ self.assertFalse(subprocess._active, "subprocess._active not empty")
+
def test_exceptions(self):
# caught & re-raised exceptions
with self.assertRaises(OSError) as c:
@@ -638,15 +650,15 @@ class POSIXProcessTestCase(unittest.TestCase):
os.remove(fname)
self.assertEqual(rc, 47)
- @unittest.skip("See issue #2777")
def test_send_signal(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
+ # Let the process initialize correctly (Issue #3137)
+ time.sleep(.1)
self.assertIs(p.poll(), None)
p.send_signal(signal.SIGINT)
self.assertNotEqual(p.wait(), 0)
- @unittest.skip("See issue #2777")
def test_kill(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
@@ -654,7 +666,6 @@ class POSIXProcessTestCase(unittest.TestCase):
p.kill()
self.assertEqual(p.wait(), -signal.SIGKILL)
- @unittest.skip("See issue #2777")
def test_terminate(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
@@ -670,6 +681,12 @@ class Win32ProcessTestCase(unittest.TestCase):
# doesn't crash on some buildbots (Alphas in particular).
test_support.reap_children()
+ def tearDown(self):
+ for inst in subprocess._active:
+ inst.wait()
+ subprocess._cleanup()
+ self.assertFalse(subprocess._active, "subprocess._active not empty")
+
def test_startupinfo(self):
# startupinfo argument
# We uses hardcoded constants, because we do not want to
@@ -736,7 +753,6 @@ class Win32ProcessTestCase(unittest.TestCase):
' -c "import sys; sys.exit(47)"')
self.assertEqual(rc, 47)
- @unittest.skip("See issue #2777")
def test_send_signal(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
@@ -744,7 +760,6 @@ class Win32ProcessTestCase(unittest.TestCase):
p.send_signal(signal.SIGTERM)
self.assertNotEqual(p.wait(), 0)
- @unittest.skip("See issue #2777")
def test_kill(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])
@@ -752,7 +767,6 @@ class Win32ProcessTestCase(unittest.TestCase):
p.kill()
self.assertNotEqual(p.wait(), 0)
- @unittest.skip("See issue #2777")
def test_terminate(self):
p = subprocess.Popen([sys.executable, "-c", "input()"])