summaryrefslogtreecommitdiff
path: root/tests/test_isalive.py
diff options
context:
space:
mode:
authorThomas Kluyver <takowl@gmail.com>2013-10-21 12:08:36 -0700
committerThomas Kluyver <takowl@gmail.com>2013-10-21 12:08:36 -0700
commitc71562035250942080601a2254c84a12bccb0b46 (patch)
tree1f4a582d8401c9bebd509790429310461e8cb811 /tests/test_isalive.py
parentfe61e78be0a7d442f08430ba6e9d3e644f6cb666 (diff)
downloadpexpect-git-c71562035250942080601a2254c84a12bccb0b46.tar.gz
Add test for wait() on process terminated by signal
Diffstat (limited to 'tests/test_isalive.py')
-rwxr-xr-xtests/test_isalive.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/test_isalive.py b/tests/test_isalive.py
index 7f02b9e..7810e2e 100755
--- a/tests/test_isalive.py
+++ b/tests/test_isalive.py
@@ -18,9 +18,9 @@ PEXPECT LICENSE
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
'''
-from __future__ import with_statement # bring 'with' stmt to py25
import pexpect
import unittest
+import signal
import sys, os, time
import PexpectTestCase
@@ -48,6 +48,15 @@ class IsAliveTestCase(PexpectTestCase.PexpectTestCase):
else:
self.fail ('Should have raised ExceptionPython because you can\'t call wait on a dead process.')
+ def test_signal_wait(self):
+ '''Test calling wait with a process terminated by a signal.'''
+ if not hasattr(signal, 'SIGALRM'):
+ return 'SKIP'
+ p = pexpect.spawn(sys.executable, ['alarm_die.py'])
+ p.wait()
+ assert p.exitstatus is None, p.exitstatus
+ self.assertEqual(p.signalstatus, signal.SIGALRM)
+
def test_expect_isalive_dead_after_normal_termination (self):
p = pexpect.spawn('ls')
p.expect(pexpect.EOF)