##// END OF EJS Templates
IPython.testing.tools without Nose
Nikita Kniazev -
Show More
@@ -21,15 +21,6 b' from io import StringIO'
21 21 from subprocess import Popen, PIPE
22 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 24 from traitlets.config.loader import Config
34 25 from IPython.utils.process import get_output_error_code
35 26 from IPython.utils.text import list_strings
@@ -252,8 +243,6 b" def ipexec_validate(fname, expected_out, expected_err='',"
252 243 None
253 244 """
254 245
255 import nose.tools as nt
256
257 246 out, err = ipexec(fname, options, commands)
258 247 #print 'OUT', out # dbg
259 248 #print 'ERR', err # dbg
@@ -261,12 +250,12 b" def ipexec_validate(fname, expected_out, expected_err='',"
261 250 # more informative than simply having an empty stdout.
262 251 if err:
263 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 254 else:
266 255 raise ValueError('Running file %r produced error: %r' %
267 256 (fname, err))
268 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 261 class TempFileMixin(unittest.TestCase):
@@ -458,10 +447,10 b" def help_output_test(subcommand=''):"
458 447 """test that `ipython [subcommand] -h` works"""
459 448 cmd = get_ipython_cmd() + [subcommand, '-h']
460 449 out, err, rc = get_output_error_code(cmd)
461 nt.assert_equal(rc, 0, err)
462 nt.assert_not_in("Traceback", err)
463 nt.assert_in("Options", out)
464 nt.assert_in("--help-all", out)
450 assert rc == 0, err
451 assert "Traceback" not in err
452 assert "Options" in out
453 assert "--help-all" in out
465 454 return out, err
466 455
467 456
@@ -469,9 +458,9 b" def help_all_output_test(subcommand=''):"
469 458 """test that `ipython [subcommand] --help-all` works"""
470 459 cmd = get_ipython_cmd() + [subcommand, '--help-all']
471 460 out, err, rc = get_output_error_code(cmd)
472 nt.assert_equal(rc, 0, err)
473 nt.assert_not_in("Traceback", err)
474 nt.assert_in("Options", out)
475 nt.assert_in("Class", out)
461 assert rc == 0, err
462 assert "Traceback" not in err
463 assert "Options" in out
464 assert "Class" in out
476 465 return out, err
477 466
General Comments 0
You need to be logged in to leave comments. Login now