##// END OF EJS Templates
Fix tests to return consistent results regardless of how they are called....
Fernando Perez -
Show More
@@ -38,8 +38,6 b' import warnings'
38 p = os.path
38 p = os.path
39 ippath = p.abspath(p.join(p.dirname(__file__),'..','..'))
39 ippath = p.abspath(p.join(p.dirname(__file__),'..','..'))
40 sys.path.insert(0, ippath)
40 sys.path.insert(0, ippath)
41 #print 'ipp:', ippath # dbg
42 #import IPython; print 'IP file:', IPython.__file__ # dbg
43
41
44 # Note: monkeypatch!
42 # Note: monkeypatch!
45 # We need to monkeypatch a small problem in nose itself first, before importing
43 # We need to monkeypatch a small problem in nose itself first, before importing
@@ -240,6 +238,7 b' class IPTester(object):'
240 return os.system(' '.join(self.call_args))
238 return os.system(' '.join(self.call_args))
241 else:
239 else:
242 def _run_cmd(self):
240 def _run_cmd(self):
241 #print >> sys.stderr, '*** CMD:', ' '.join(self.call_args) # dbg
243 subp = subprocess.Popen(self.call_args)
242 subp = subprocess.Popen(self.call_args)
244 self.pids.append(subp.pid)
243 self.pids.append(subp.pid)
245 # If this fails, the pid will be left in self.pids and cleaned up
244 # If this fails, the pid will be left in self.pids and cleaned up
@@ -295,7 +294,7 b' def make_runners():'
295 trial_pkg_names.append('kernel')
294 trial_pkg_names.append('kernel')
296
295
297 # For debugging this code, only load quick stuff
296 # For debugging this code, only load quick stuff
298 #nose_pkg_names = ['config', 'utils'] # dbg
297 #nose_pkg_names = ['core'] # dbg
299 #trial_pkg_names = [] # dbg
298 #trial_pkg_names = [] # dbg
300
299
301 # Make fully qualified package names prepending 'IPython.' to our name lists
300 # Make fully qualified package names prepending 'IPython.' to our name lists
@@ -320,7 +319,20 b' def run_iptest():'
320 warnings.filterwarnings('ignore',
319 warnings.filterwarnings('ignore',
321 'This will be removed soon. Use IPython.testing.util instead')
320 'This will be removed soon. Use IPython.testing.util instead')
322
321
323 argv = sys.argv + [ '--detailed-errors',
322 argv = sys.argv + [ '--detailed-errors', # extra info in tracebacks
323
324 # I don't fully understand why we need this one, but
325 # depending on what directory the test suite is run
326 # from, if we don't give it, 0 tests get run.
327 # Specifically, if the test suite is run from the
328 # source dir with an argument (like 'iptest.py
329 # IPython.core', 0 tests are run, even if the same call
330 # done in this directory works fine). It appears that
331 # if the requested package is in the current dir,
332 # nose bails early by default. Since it's otherwise
333 # harmless, leave it in by default.
334 '--traverse-namespace',
335
324 # Loading ipdoctest causes problems with Twisted, but
336 # Loading ipdoctest causes problems with Twisted, but
325 # our test suite runner now separates things and runs
337 # our test suite runner now separates things and runs
326 # all Twisted tests with trial.
338 # all Twisted tests with trial.
@@ -49,7 +49,7 b' else:'
49
49
50 def find_cmd(cmd):
50 def find_cmd(cmd):
51 """Find the full path to a command using which."""
51 """Find the full path to a command using which."""
52 return getoutputerror('which %s' % cmd)[0]
52 return getoutputerror('/usr/bin/env which %s' % cmd)[0]
53
53
54
54
55 def get_long_path_name(path):
55 def get_long_path_name(path):
@@ -2,13 +2,17 b''
2 """Test script for IPython.
2 """Test script for IPython.
3
3
4 The actual ipython test script to be installed with 'python setup.py install'
4 The actual ipython test script to be installed with 'python setup.py install'
5 is in './scripts' directory. This file is here (ipython source root directory)
5 is in './scripts' directory, and will test IPython from an importable
6 to facilitate non-root 'zero-installation testing' (just copy the source tree
6 location.
7 somewhere and run ipython.py) and development.
7
8 This file is here (ipython source root directory) to facilitate non-root
9 'zero-installation testing and development' (just copy the source tree
10 somewhere and run iptest.py).
8
11
9 You can run this script directly, type -h to see all options."""
12 You can run this script directly, type -h to see all options."""
10
13
11 # Ensure that the imported IPython is the local one, not a system-wide one
14 # Ensure that the imported IPython packages come from *THIS* IPython, not some
15 # other one that may exist system-wide
12 import os, sys
16 import os, sys
13 this_dir = os.path.dirname(os.path.abspath(__file__))
17 this_dir = os.path.dirname(os.path.abspath(__file__))
14 sys.path.insert(0, this_dir)
18 sys.path.insert(0, this_dir)
General Comments 0
You need to be logged in to leave comments. Login now