##// END OF EJS Templates
Fix problems with multiline doctests and add docs about testing....
Fix problems with multiline doctests and add docs about testing. Also enabled some more testings that were blacklisted, now that the testing machinery is more robust.

File last commit:

r1868:2f50ff6b
r1868:2f50ff6b
Show More
iptest.py
92 lines | 3.4 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',
'IPython_doctest_plugin',
'IPython/Gnuplot',
'IPython/Extensions/ipy_',
'IPython/Extensions/clearcmd',
'IPython/Extensions/PhysicalQIn',
'IPython/Extensions/scitedirector',
]
#-----------------------------------------------------------------------------
# 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')
Fernando Perez
Fixes to testing system: ipdocetst plugin wasn't being properly loaded.
r1761 argv = sys.argv + [ '--with-ipdoctest',
'--doctest-tests','--doctest-extension=txt',
'--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
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
Cleanup testing machinery.
r1851 # Construct list of plugins, omitting the existing doctest plugin.
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)