##// END OF EJS Templates
New 'master' test runner....
New 'master' test runner. This is not even added to the user-visible scripts yet, until we test it some more. But at least it works...

File last commit:

r1968:96408179
r1970:9edc6534
Show More
iptest.py
103 lines | 4.0 KiB | text/x-python | PythonLexer
Fernando Perez
Add module I forgot
r1574 # -*- coding: utf-8 -*-
"""IPython Test Suite Runner.
Fernando Perez
Cleanup testing machinery.
r1851
This module provides a main entry point to a user script to test IPython itself
from the command line. The main() routine can be used in a similar manner to
the ``nosetests`` script, and it takes similar arguments, but if no arguments
are given it defaults to testing all of IPython. This should be preferred to
using plain ``nosetests`` because a number of nose plugins necessary to test
IPython correctly are automatically configured by this code.
Fernando Perez
Add module I forgot
r1574 """
Fernando Perez
Cleanup testing machinery.
r1851 #-----------------------------------------------------------------------------
# Module imports
#-----------------------------------------------------------------------------
# stdlib
Fernando Perez
Add module I forgot
r1574 import sys
import warnings
Fernando Perez
Cleanup testing machinery.
r1851 # third-party
Fernando Perez
Add module I forgot
r1574 import nose.plugins.builtin
Fernando Perez
Cleanup testing machinery.
r1851 from nose.core import TestProgram
Fernando Perez
Add module I forgot
r1574
Fernando Perez
Cleanup testing machinery.
r1851 # Our own imports
Fernando Perez
Add module I forgot
r1574 from IPython.testing.plugin.ipdoctest import IPythonDoctest
Fernando Perez
Cleanup testing machinery.
r1851 #-----------------------------------------------------------------------------
# Constants and globals
#-----------------------------------------------------------------------------
# For the IPythonDoctest plugin, we need to exclude certain patterns that cause
# testing problems. We should strive to minimize the number of skipped
# modules, since this means untested code. As the testing machinery
# solidifies, this list should eventually become empty.
EXCLUDE = ['IPython/external/',
'IPython/platutils_win32',
'IPython/frontend/cocoa',
Fernando Perez
Skip things we shouldn't be testing
r1961 'IPython/frontend/process/winprocess.py',
Fernando Perez
Cleanup testing machinery.
r1851 'IPython_doctest_plugin',
'IPython/Gnuplot',
'IPython/Extensions/ipy_',
'IPython/Extensions/clearcmd',
'IPython/Extensions/PhysicalQIn',
'IPython/Extensions/scitedirector',
Fernando Perez
Skip things we shouldn't be testing
r1961 'IPython/Extensions/numeric_formats',
'IPython/testing/attic',
Fernando Perez
Cleanup testing machinery.
r1851 ]
#-----------------------------------------------------------------------------
# Functions and classes
#-----------------------------------------------------------------------------
Fernando Perez
Add module I forgot
r1574 def main():
"""Run the IPython test suite.
"""
warnings.filterwarnings('ignore',
'This will be removed soon. Use IPython.testing.util instead')
Brian Granger
Temporarily disabling the ipdoctest nose plugin....
r1888 argv = sys.argv + [
# Loading ipdoctest causes problems with Twisted.
# I am removing this as a temporary fix to get the
# test suite back into working shape. Our nose
# plugin needs to be gone through with a fine
# toothed comb to find what is causing the problem.
Fernando Perez
Reactivate --with-ipdoctest option by default, now that trial is isolated.
r1968 '--with-ipdoctest',
Fernando Perez
- Make ipdoctest a little cleaner by giving it separate option names....
r1910 '--ipdoctest-tests','--ipdoctest-extension=txt',
Fernando Perez
Fixes to testing system: ipdocetst plugin wasn't being properly loaded.
r1761 '--detailed-errors',
Fernando Perez
Add module I forgot
r1574
Fernando Perez
Fixes to testing system: ipdocetst plugin wasn't being properly loaded.
r1761 # We add --exe because of setuptools' imbecility (it
# blindly does chmod +x on ALL files). Nose does the
# right thing and it tries to avoid executables,
# setuptools unfortunately forces our hand here. This
# has been discussed on the distutils list and the
# setuptools devs refuse to fix this problem!
'--exe',
]
Fernando Perez
Add module I forgot
r1574
Fernando Perez
Update decorators and test scripts.
r1848 # Detect if any tests were required by explicitly calling an IPython
# submodule or giving a specific path
has_tests = False
Fernando Perez
Add module I forgot
r1574 for arg in sys.argv:
Fernando Perez
Update decorators and test scripts.
r1848 if 'IPython' in arg or arg.endswith('.py') or \
(':' in arg and '.py' in arg):
has_tests = True
Fernando Perez
Add module I forgot
r1574 break
Fernando Perez
- Make ipdoctest a little cleaner by giving it separate option names....
r1910
Fernando Perez
Update decorators and test scripts.
r1848 # If nothing was specifically requested, test full IPython
if not has_tests:
Fernando Perez
Add module I forgot
r1574 argv.append('IPython')
Fernando Perez
- Make ipdoctest a little cleaner by giving it separate option names....
r1910 # Construct list of plugins, omitting the existing doctest plugin, which
# ours replaces (and extends).
Fernando Perez
Cleanup testing machinery.
r1851 plugins = [IPythonDoctest(EXCLUDE)]
Fernando Perez
Fixes to testing system: ipdocetst plugin wasn't being properly loaded.
r1761 for p in nose.plugins.builtin.plugins:
plug = p()
if plug.name == 'doctest':
continue
#print '*** adding plugin:',plug.name # dbg
plugins.append(plug)
Fernando Perez
Add module I forgot
r1574 TestProgram(argv=argv,plugins=plugins)