##// END OF EJS Templates
Fixes for test suite in win32 when all dependencies (esp. Twisted) are...
Fernando Perez -
Show More
@@ -318,3 +318,7 b" skip_if_not_osx = skipif(sys.platform != 'darwin',"
318 skipif_not_numpy = skipif(numpy_not_available,"This test requires numpy")
318 skipif_not_numpy = skipif(numpy_not_available,"This test requires numpy")
319
319
320 skipknownfailure = skip('This test is known to fail')
320 skipknownfailure = skip('This test is known to fail')
321
322 # A null 'decorator', useful to make more readable code that needs to pick
323 # between different decorators based on OS or other conditions
324 null_deco = lambda f: f
@@ -45,6 +45,7 b' from nose.core import TestProgram'
45 from IPython.utils import genutils
45 from IPython.utils import genutils
46 from IPython.utils.platutils import find_cmd, FindCmdError
46 from IPython.utils.platutils import find_cmd, FindCmdError
47 from . import globalipapp
47 from . import globalipapp
48 from . import tools
48 from .plugin.ipdoctest import IPythonDoctest
49 from .plugin.ipdoctest import IPythonDoctest
49
50
50 pjoin = path.join
51 pjoin = path.join
@@ -57,6 +58,10 b' pjoin = path.join'
57 warnings.filterwarnings('ignore', 'the sets module is deprecated',
58 warnings.filterwarnings('ignore', 'the sets module is deprecated',
58 DeprecationWarning )
59 DeprecationWarning )
59
60
61 # This one also comes from Twisted
62 warnings.filterwarnings('ignore', 'the sha module is deprecated',
63 DeprecationWarning)
64
60 #-----------------------------------------------------------------------------
65 #-----------------------------------------------------------------------------
61 # Logic for skipping doctests
66 # Logic for skipping doctests
62 #-----------------------------------------------------------------------------
67 #-----------------------------------------------------------------------------
@@ -102,8 +107,11 b' def make_exclude():'
102 ipjoin('quarantine'),
107 ipjoin('quarantine'),
103 ipjoin('deathrow'),
108 ipjoin('deathrow'),
104 ipjoin('testing', 'attic'),
109 ipjoin('testing', 'attic'),
105 ipjoin('testing', 'tools'),
110 # This guy is probably attic material
106 ipjoin('testing', 'mkdoctests'),
111 ipjoin('testing', 'mkdoctests'),
112 # Testing inputhook will need a lot of thought, to figure out
113 # how to have tests that don't lock up with the gui event
114 # loops in the picture
107 ipjoin('lib', 'inputhook'),
115 ipjoin('lib', 'inputhook'),
108 # Config files aren't really importable stand-alone
116 # Config files aren't really importable stand-alone
109 ipjoin('config', 'default'),
117 ipjoin('config', 'default'),
@@ -193,9 +201,9 b' class IPTester(object):'
193 # path:
201 # path:
194 iptest_path = pjoin(genutils.get_ipython_package_dir(),
202 iptest_path = pjoin(genutils.get_ipython_package_dir(),
195 'scripts','iptest')
203 'scripts','iptest')
196 self.runner = ['python', iptest_path, '-v']
204 self.runner = tools.cmd2argv(iptest_path) + ['-v']
197 else:
205 else:
198 self.runner = ['python', os.path.abspath(find_cmd('trial'))]
206 self.runner = tools.cmd2argv(os.path.abspath(find_cmd('trial')))
199 if params is None:
207 if params is None:
200 params = []
208 params = []
201 if isinstance(params,str):
209 if isinstance(params,str):
@@ -52,8 +52,6 b" if sys.version[0]=='2':"
52 else:
52 else:
53 from ._paramtestpy3 import ParametricTestCase
53 from ._paramtestpy3 import ParametricTestCase
54
54
55 from . import globalipapp
56
57 #-----------------------------------------------------------------------------
55 #-----------------------------------------------------------------------------
58 # Classes and functions
56 # Classes and functions
59 #-----------------------------------------------------------------------------
57 #-----------------------------------------------------------------------------
@@ -83,6 +81,8 b' class IPython2PythonConverter(object):'
83
81
84 def __call__(self, ds):
82 def __call__(self, ds):
85 """Convert IPython prompts to python ones in a string."""
83 """Convert IPython prompts to python ones in a string."""
84 from . import globalipapp
85
86 pyps1 = '>>> '
86 pyps1 = '>>> '
87 pyps2 = '... '
87 pyps2 = '... '
88 pyout = ''
88 pyout = ''
@@ -25,6 +25,7 b' Authors'
25 #-----------------------------------------------------------------------------
25 #-----------------------------------------------------------------------------
26 # Required modules and packages
26 # Required modules and packages
27 #-----------------------------------------------------------------------------
27 #-----------------------------------------------------------------------------
28 from __future__ import absolute_import
28
29
29 import os
30 import os
30 import re
31 import re
@@ -42,6 +43,8 b' except ImportError:'
42
43
43 from IPython.utils import genutils, platutils
44 from IPython.utils import genutils, platutils
44
45
46 from . import decorators as dec
47
45 #-----------------------------------------------------------------------------
48 #-----------------------------------------------------------------------------
46 # Globals
49 # Globals
47 #-----------------------------------------------------------------------------
50 #-----------------------------------------------------------------------------
@@ -62,7 +65,11 b' if has_nose:'
62 # Functions and classes
65 # Functions and classes
63 #-----------------------------------------------------------------------------
66 #-----------------------------------------------------------------------------
64
67
68 # The docstring for full_path doctests differently on win32 (different path
69 # separator) so just skip the doctest there. The example remains informative.
70 doctest_deco = dec.skip_doctest if sys.platform == 'win32' else dec.null_deco
65
71
72 @doctest_deco
66 def full_path(startPath,files):
73 def full_path(startPath,files):
67 """Make full paths for all the listed files, based on startPath.
74 """Make full paths for all the listed files, based on startPath.
68
75
@@ -142,6 +149,40 b' def parse_test_output(txt):'
142 parse_test_output.__test__ = False
149 parse_test_output.__test__ = False
143
150
144
151
152 def cmd2argv(cmd):
153 r"""Take the path of a command and return a list (argv-style).
154
155 For a given path ``cmd``, this returns [cmd] if cmd's extension is .exe,
156 .com or .bat, and ['python', cmd] otherwise.
157
158 This is mostly a Windows utility, to deal with the fact that the scripts in
159 Windows get wrapped in .exe entry points, so we have to call them
160 differently.
161
162 Parameters
163 ----------
164 cmd : string
165 The path of the command.
166
167 Returns
168 -------
169 argv-style list.
170
171 Examples
172 --------
173 In [2]: cmd2argv('/usr/bin/ipython')
174 Out[2]: ['python', '/usr/bin/ipython']
175
176 In [3]: cmd2argv(r'C:\Python26\Scripts\ipython.exe')
177 Out[3]: ['C:\\Python26\\Scripts\\ipython.exe']
178 """
179 ext = os.path.splitext(cmd)[1]
180 if ext in ['.exe', '.com', '.bat']:
181 return [cmd]
182 else:
183 return ['python', cmd]
184
185
145 def temp_pyfile(src, ext='.py'):
186 def temp_pyfile(src, ext='.py'):
146 """Make a temporary python file, return filename and filehandle.
187 """Make a temporary python file, return filename and filehandle.
147
188
General Comments 0
You need to be logged in to leave comments. Login now