##// END OF EJS Templates
test exit code with csh...
MinRK -
Show More
@@ -25,9 +25,12 b' from os.path import join'
25 25 import nose.tools as nt
26 26
27 27 from IPython.core.inputtransformer import InputTransformer
28 from IPython.testing.decorators import skipif, skip_win32, onlyif_unicode_paths
28 from IPython.testing.decorators import (
29 skipif, skip_win32, onlyif_unicode_paths, onlyif_cmds_exist,
30 )
29 31 from IPython.testing import tools as tt
30 32 from IPython.utils import io
33 from IPython.utils.process import find_cmd
31 34 from IPython.utils import py3compat
32 35 from IPython.utils.py3compat import unicode_type, PY3
33 36
@@ -436,7 +439,7 b' class ExitCodeChecks(tt.TempFileMixin):'
436 439 def test_exit_code_error(self):
437 440 self.system('exit 1')
438 441 self.assertEqual(ip.user_ns['_exit_code'], 1)
439
442
440 443 @skipif(not hasattr(signal, 'SIGALRM'))
441 444 def test_exit_code_signal(self):
442 445 self.mktmp("import signal, time\n"
@@ -444,6 +447,18 b' class ExitCodeChecks(tt.TempFileMixin):'
444 447 "time.sleep(1)\n")
445 448 self.system("%s %s" % (sys.executable, self.fname))
446 449 self.assertEqual(ip.user_ns['_exit_code'], -signal.SIGALRM)
450
451 @onlyif_cmds_exist("csh")
452 def test_exit_code_signal_csh(self):
453 SHELL = os.environ.get('SHELL', None)
454 os.environ['SHELL'] = find_cmd("csh")
455 try:
456 self.test_exit_code_signal()
457 finally:
458 if SHELL is not None:
459 os.environ['SHELL'] = SHELL
460 else:
461 del os.environ['SHELL']
447 462
448 463 class TestSystemRaw(unittest.TestCase, ExitCodeChecks):
449 464 system = ip.system_raw
General Comments 0
You need to be logged in to leave comments. Login now