##// END OF EJS Templates
IPython.testing.tools without Nose
Nikita Kniazev -
Show More
@@ -21,15 +21,6 b' from io import StringIO'
21 from subprocess import Popen, PIPE
21 from subprocess import Popen, PIPE
22 from unittest.mock import patch
22 from unittest.mock import patch
23
23
24 try:
25 # These tools are used by parts of the runtime, so we make the nose
26 # dependency optional at this point. Nose is a hard dependency to run the
27 # test suite, but NOT to use ipython itself.
28 import nose.tools as nt
29 has_nose = True
30 except ImportError:
31 has_nose = False
32
33 from traitlets.config.loader import Config
24 from traitlets.config.loader import Config
34 from IPython.utils.process import get_output_error_code
25 from IPython.utils.process import get_output_error_code
35 from IPython.utils.text import list_strings
26 from IPython.utils.text import list_strings
@@ -252,8 +243,6 b" def ipexec_validate(fname, expected_out, expected_err='',"
252 None
243 None
253 """
244 """
254
245
255 import nose.tools as nt
256
257 out, err = ipexec(fname, options, commands)
246 out, err = ipexec(fname, options, commands)
258 #print 'OUT', out # dbg
247 #print 'OUT', out # dbg
259 #print 'ERR', err # dbg
248 #print 'ERR', err # dbg
@@ -261,12 +250,12 b" def ipexec_validate(fname, expected_out, expected_err='',"
261 # more informative than simply having an empty stdout.
250 # more informative than simply having an empty stdout.
262 if err:
251 if err:
263 if expected_err:
252 if expected_err:
264 nt.assert_equal("\n".join(err.strip().splitlines()), "\n".join(expected_err.strip().splitlines()))
253 assert err.strip().splitlines() == expected_err.strip().splitlines()
265 else:
254 else:
266 raise ValueError('Running file %r produced error: %r' %
255 raise ValueError('Running file %r produced error: %r' %
267 (fname, err))
256 (fname, err))
268 # If no errors or output on stderr was expected, match stdout
257 # If no errors or output on stderr was expected, match stdout
269 nt.assert_equal("\n".join(out.strip().splitlines()), "\n".join(expected_out.strip().splitlines()))
258 assert out.strip().splitlines() == expected_out.strip().splitlines()
270
259
271
260
272 class TempFileMixin(unittest.TestCase):
261 class TempFileMixin(unittest.TestCase):
@@ -458,10 +447,10 b" def help_output_test(subcommand=''):"
458 """test that `ipython [subcommand] -h` works"""
447 """test that `ipython [subcommand] -h` works"""
459 cmd = get_ipython_cmd() + [subcommand, '-h']
448 cmd = get_ipython_cmd() + [subcommand, '-h']
460 out, err, rc = get_output_error_code(cmd)
449 out, err, rc = get_output_error_code(cmd)
461 nt.assert_equal(rc, 0, err)
450 assert rc == 0, err
462 nt.assert_not_in("Traceback", err)
451 assert "Traceback" not in err
463 nt.assert_in("Options", out)
452 assert "Options" in out
464 nt.assert_in("--help-all", out)
453 assert "--help-all" in out
465 return out, err
454 return out, err
466
455
467
456
@@ -469,9 +458,9 b" def help_all_output_test(subcommand=''):"
469 """test that `ipython [subcommand] --help-all` works"""
458 """test that `ipython [subcommand] --help-all` works"""
470 cmd = get_ipython_cmd() + [subcommand, '--help-all']
459 cmd = get_ipython_cmd() + [subcommand, '--help-all']
471 out, err, rc = get_output_error_code(cmd)
460 out, err, rc = get_output_error_code(cmd)
472 nt.assert_equal(rc, 0, err)
461 assert rc == 0, err
473 nt.assert_not_in("Traceback", err)
462 assert "Traceback" not in err
474 nt.assert_in("Options", out)
463 assert "Options" in out
475 nt.assert_in("Class", out)
464 assert "Class" in out
476 return out, err
465 return out, err
477
466
General Comments 0
You need to be logged in to leave comments. Login now