diff options
author | pcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2010-11-28 02:24:46 +0000 |
---|---|---|
committer | pcarrier <pcarrier@ef72aa8b-4018-0410-8976-d6e080ef94d8> | 2010-11-28 02:24:46 +0000 |
commit | cb9abbe495d96d22f48b3285468ad0239d9a9eeb (patch) | |
tree | ed470350a2c2a99079ed88082efbb14e6a37c8c5 /tests | |
parent | 91bb678ec3e0d9f36b8ebefe89888325505ef82d (diff) | |
download | sos-cb9abbe495d96d22f48b3285468ad0239d9a9eeb.tar.gz |
[tests] worker: tests reflecting the SIGINT design change
git-svn-id: svn+ssh://svn.fedorahosted.org/svn/sos/trunk@1053 ef72aa8b-4018-0410-8976-d6e080ef94d8
Diffstat (limited to 'tests')
-rw-r--r-- | tests/worker.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/tests/worker.py b/tests/worker.py index 25ff5aab..cf121f38 100644 --- a/tests/worker.py +++ b/tests/worker.py @@ -14,6 +14,9 @@ class WorkerTests(unittest.TestCase): def prompt(self, n): return ('#%i#\r\n' % n) + def interrupted(self, n): + return ('#%i# INTERRUPTED\r\n' % n) + def setUp(self): self.worker = pexpect.spawn('python ../worker/worker.py') # worker should always be very fast to span @@ -48,24 +51,32 @@ class WorkerTests(unittest.TestCase): self.sendlines(['exit']) self.__finishes_ok__() - def test_ctrlc_on_cmd_prompt_quits(self): + def test_ctrlc_when_running(self): + self.sendlines(['exec', 'sleep 1; exec echo lol']) self.sig(SIGINT) - self.expect(pexpect.EOF) - self.__finishes_ok__() + self.expect(self.interrupted(0)+self.prompt(1)) + self.test_exit() + + def test_ctrlc_on_cmd_prompt(self): + self.sig(SIGINT) + self.expect(self.interrupted(0)+self.prompt(1)) + self.test_exit() - def test_ctrlc_when_entering_command_quits(self): + def test_ctrlc_when_entering_command(self): # "Mon clavier se blo" -- French reference self.send('glo') self.sig(SIGINT) - self.expect(pexpect.EOF) + self.expect(self.interrupted(0)+self.prompt(1)) + self.test_exit() def test_ctrlc_on_readparms_drops(self): self.sendlines(['exec']) self.sig(SIGINT) - self.expect(self.prompt(0)) + self.expect(self.interrupted(0)+self.prompt(1)) self.sendlines(['glob']) self.sig(SIGINT) - self.expect(self.prompt(0)) + self.expect(self.interrupted(1)+self.prompt(2)) + self.test_exit() def test_basic_noop(self): self.sendlines(['noop']) |