Show More
@@ -55,9 +55,6 b' import unittest' | |||||
55 | # This is Michele Simionato's decorator module, kept verbatim. |
|
55 | # This is Michele Simionato's decorator module, kept verbatim. | |
56 | from IPython.external.decorator import decorator, update_wrapper |
|
56 | from IPython.external.decorator import decorator, update_wrapper | |
57 |
|
57 | |||
58 | # Our own modules |
|
|||
59 | import nosepatch # monkeypatch nose |
|
|||
60 |
|
||||
61 | # We already have python3-compliant code for parametric tests |
|
58 | # We already have python3-compliant code for parametric tests | |
62 | if sys.version[0]=='2': |
|
59 | if sys.version[0]=='2': | |
63 | from _paramtestpy2 import parametric, ParametricTestCase |
|
60 | from _paramtestpy2 import parametric, ParametricTestCase |
@@ -22,6 +22,7 b' from __future__ import absolute_import' | |||||
22 | # Module imports |
|
22 | # Module imports | |
23 | #----------------------------------------------------------------------------- |
|
23 | #----------------------------------------------------------------------------- | |
24 |
|
24 | |||
|
25 | # Stdlib | |||
25 | import os |
|
26 | import os | |
26 | import os.path as path |
|
27 | import os.path as path | |
27 | import signal |
|
28 | import signal | |
@@ -31,9 +32,16 b' import tempfile' | |||||
31 | import time |
|
32 | import time | |
32 | import warnings |
|
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 | import nose.plugins.builtin |
|
41 | import nose.plugins.builtin | |
35 | from nose.core import TestProgram |
|
42 | from nose.core import TestProgram | |
36 |
|
43 | |||
|
44 | # Our own imports | |||
37 | from IPython.utils import genutils |
|
45 | from IPython.utils import genutils | |
38 | from IPython.utils.platutils import find_cmd, FindCmdError |
|
46 | from IPython.utils.platutils import find_cmd, FindCmdError | |
39 | from . import globalipapp |
|
47 | from . import globalipapp |
@@ -46,9 +46,6 b' try:' | |||||
46 | except: |
|
46 | except: | |
47 | from ._doctest26 import TestResults |
|
47 | from ._doctest26 import TestResults | |
48 |
|
48 | |||
49 | # Our own, a nose monkeypatch |
|
|||
50 | from . import nosepatch |
|
|||
51 |
|
||||
52 | # We already have python3-compliant code for parametric tests |
|
49 | # We already have python3-compliant code for parametric tests | |
53 | if sys.version[0]=='2': |
|
50 | if sys.version[0]=='2': | |
54 | from ._paramtestpy2 import ParametricTestCase |
|
51 | from ._paramtestpy2 import ParametricTestCase |
@@ -31,7 +31,14 b' import re' | |||||
31 | import sys |
|
31 | import sys | |
32 | import tempfile |
|
32 | import tempfile | |
33 |
|
33 | |||
|
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. | |||
34 | import nose.tools as nt |
|
38 | import nose.tools as nt | |
|
39 | has_nose = True | |||
|
40 | except ImportError: | |||
|
41 | has_nose = False | |||
35 |
|
42 | |||
36 | from IPython.utils import genutils, platutils |
|
43 | from IPython.utils import genutils, platutils | |
37 |
|
44 | |||
@@ -47,6 +54,7 b' def %(name)s(*a,**kw):' | |||||
47 | return nt.%(name)s(*a,**kw) |
|
54 | return nt.%(name)s(*a,**kw) | |
48 | """ |
|
55 | """ | |
49 |
|
56 | |||
|
57 | if has_nose: | |||
50 | for _x in [a for a in dir(nt) if a.startswith('assert')]: |
|
58 | for _x in [a for a in dir(nt) if a.startswith('assert')]: | |
51 | exec _tpl % dict(name=_x) |
|
59 | exec _tpl % dict(name=_x) | |
52 |
|
60 | |||
@@ -228,6 +236,8 b' def ipexec_validate(fname, expected_out, expected_err=None,' | |||||
228 | None |
|
236 | None | |
229 | """ |
|
237 | """ | |
230 |
|
238 | |||
|
239 | import nose.tools as nt | |||
|
240 | ||||
231 | out, err = ipexec(fname) |
|
241 | out, err = ipexec(fname) | |
232 | nt.assert_equals(out.strip(), expected_out.strip()) |
|
242 | nt.assert_equals(out.strip(), expected_out.strip()) | |
233 | if expected_err: |
|
243 | if expected_err: |
General Comments 0
You need to be logged in to leave comments.
Login now