Show More
@@ -55,9 +55,6 b' import unittest' | |||
|
55 | 55 | # This is Michele Simionato's decorator module, kept verbatim. |
|
56 | 56 | from IPython.external.decorator import decorator, update_wrapper |
|
57 | 57 | |
|
58 | # Our own modules | |
|
59 | import nosepatch # monkeypatch nose | |
|
60 | ||
|
61 | 58 | # We already have python3-compliant code for parametric tests |
|
62 | 59 | if sys.version[0]=='2': |
|
63 | 60 | from _paramtestpy2 import parametric, ParametricTestCase |
@@ -22,6 +22,7 b' from __future__ import absolute_import' | |||
|
22 | 22 | # Module imports |
|
23 | 23 | #----------------------------------------------------------------------------- |
|
24 | 24 | |
|
25 | # Stdlib | |
|
25 | 26 | import os |
|
26 | 27 | import os.path as path |
|
27 | 28 | import signal |
@@ -31,9 +32,16 b' import tempfile' | |||
|
31 | 32 | import time |
|
32 | 33 | import warnings |
|
33 | 34 | |
|
35 | # Note: monkeypatch! | |
|
36 | # We need to monkeypatch a small problem in nose itself first, before importing | |
|
37 | # it for actual use. This should get into nose upstream, but its release cycle | |
|
38 | # is slow and we need it for our parametric tests to work correctly. | |
|
39 | from . import nosepatch | |
|
40 | # Now, proceed to import nose itself | |
|
34 | 41 | import nose.plugins.builtin |
|
35 | 42 | from nose.core import TestProgram |
|
36 | 43 | |
|
44 | # Our own imports | |
|
37 | 45 | from IPython.utils import genutils |
|
38 | 46 | from IPython.utils.platutils import find_cmd, FindCmdError |
|
39 | 47 | from . import globalipapp |
@@ -46,9 +46,6 b' try:' | |||
|
46 | 46 | except: |
|
47 | 47 | from ._doctest26 import TestResults |
|
48 | 48 | |
|
49 | # Our own, a nose monkeypatch | |
|
50 | from . import nosepatch | |
|
51 | ||
|
52 | 49 | # We already have python3-compliant code for parametric tests |
|
53 | 50 | if sys.version[0]=='2': |
|
54 | 51 | from ._paramtestpy2 import ParametricTestCase |
@@ -31,7 +31,14 b' import re' | |||
|
31 | 31 | import sys |
|
32 | 32 | import tempfile |
|
33 | 33 | |
|
34 | import nose.tools as nt | |
|
34 | try: | |
|
35 | # These tools are used by parts of the runtime, so we make the nose | |
|
36 | # dependency optional at this point. Nose is a hard dependency to run the | |
|
37 | # test suite, but NOT to use ipython itself. | |
|
38 | import nose.tools as nt | |
|
39 | has_nose = True | |
|
40 | except ImportError: | |
|
41 | has_nose = False | |
|
35 | 42 | |
|
36 | 43 | from IPython.utils import genutils, platutils |
|
37 | 44 | |
@@ -47,8 +54,9 b' def %(name)s(*a,**kw):' | |||
|
47 | 54 | return nt.%(name)s(*a,**kw) |
|
48 | 55 | """ |
|
49 | 56 | |
|
50 | for _x in [a for a in dir(nt) if a.startswith('assert')]: | |
|
51 | exec _tpl % dict(name=_x) | |
|
57 | if has_nose: | |
|
58 | for _x in [a for a in dir(nt) if a.startswith('assert')]: | |
|
59 | exec _tpl % dict(name=_x) | |
|
52 | 60 | |
|
53 | 61 | #----------------------------------------------------------------------------- |
|
54 | 62 | # Functions and classes |
@@ -228,6 +236,8 b' def ipexec_validate(fname, expected_out, expected_err=None,' | |||
|
228 | 236 | None |
|
229 | 237 | """ |
|
230 | 238 | |
|
239 | import nose.tools as nt | |
|
240 | ||
|
231 | 241 | out, err = ipexec(fname) |
|
232 | 242 | nt.assert_equals(out.strip(), expected_out.strip()) |
|
233 | 243 | if expected_err: |
General Comments 0
You need to be logged in to leave comments.
Login now