##// END OF EJS Templates
Cleanup testing machinery.
Fernando Perez -
Show More
@@ -0,0 +1,6 b''
1 """Simple script to instantiate a class for testing %run"""
2
3 class foo: pass
4
5 def f():
6 foo()
@@ -1,15 +1,53 b''
1 1 # -*- coding: utf-8 -*-
2 2 """IPython Test Suite Runner.
3
4 This module provides a main entry point to a user script to test IPython itself
5 from the command line. The main() routine can be used in a similar manner to
6 the ``nosetests`` script, and it takes similar arguments, but if no arguments
7 are given it defaults to testing all of IPython. This should be preferred to
8 using plain ``nosetests`` because a number of nose plugins necessary to test
9 IPython correctly are automatically configured by this code.
3 10 """
4 11
12 #-----------------------------------------------------------------------------
13 # Module imports
14 #-----------------------------------------------------------------------------
15
16 # stdlib
5 17 import sys
6 18 import warnings
7 19
8 from nose.core import TestProgram
20 # third-party
9 21 import nose.plugins.builtin
22 from nose.core import TestProgram
10 23
24 # Our own imports
11 25 from IPython.testing.plugin.ipdoctest import IPythonDoctest
12 26
27 #-----------------------------------------------------------------------------
28 # Constants and globals
29 #-----------------------------------------------------------------------------
30
31 # For the IPythonDoctest plugin, we need to exclude certain patterns that cause
32 # testing problems. We should strive to minimize the number of skipped
33 # modules, since this means untested code. As the testing machinery
34 # solidifies, this list should eventually become empty.
35 EXCLUDE = ['IPython/external/',
36 'IPython/platutils_win32',
37 'IPython/frontend/cocoa',
38 'IPython_doctest_plugin',
39 'IPython/Gnuplot',
40 'IPython/Extensions/ipy_',
41 'IPython/Extensions/clearcmd',
42 'IPython/Extensions/PhysicalQIn',
43 'IPython/Extensions/scitedirector',
44 'IPython/testing/plugin',
45 ]
46
47 #-----------------------------------------------------------------------------
48 # Functions and classes
49 #-----------------------------------------------------------------------------
50
13 51 def main():
14 52 """Run the IPython test suite.
15 53 """
@@ -42,8 +80,8 b' def main():'
42 80 if not has_tests:
43 81 argv.append('IPython')
44 82
45 # construct list of plugins, omitting the existing doctest plugin
46 plugins = [IPythonDoctest()]
83 # Construct list of plugins, omitting the existing doctest plugin.
84 plugins = [IPythonDoctest(EXCLUDE)]
47 85 for p in nose.plugins.builtin.plugins:
48 86 plug = p()
49 87 if plug.name == 'doctest':
@@ -677,6 +677,22 b' class ExtensionDoctest(doctests.Doctest):'
677 677 name = 'extdoctest' # call nosetests with --with-extdoctest
678 678 enabled = True
679 679
680 def __init__(self,exclude_patterns=None):
681 """Create a new ExtensionDoctest plugin.
682
683 Parameters
684 ----------
685
686 exclude_patterns : sequence of strings, optional
687 These patterns are compiled as regular expressions, subsequently used
688 to exclude any filename which matches them from inclusion in the test
689 suite (using pattern.search(), NOT pattern.match() ).
690 """
691 if exclude_patterns is None:
692 exclude_patterns = []
693 self.exclude_patterns = map(re.compile,exclude_patterns)
694 doctests.Doctest.__init__(self)
695
680 696 def options(self, parser, env=os.environ):
681 697 Plugin.options(self, parser, env)
682 698 parser.add_option('--doctest-tests', action='store_true',
@@ -783,20 +799,8 b' class ExtensionDoctest(doctests.Doctest):'
783 799 """
784 800 #print '*** ipdoctest- wantFile:',filename # dbg
785 801
786 # XXX - temporarily hardcoded list, will move to driver later
787 exclude = ['IPython/external/',
788 'IPython/platutils_win32',
789 'IPython/frontend/cocoa',
790 'IPython_doctest_plugin',
791 'IPython/Gnuplot',
792 'IPython/Extensions/ipy_',
793 'IPython/Extensions/PhysicalQIn',
794 'IPython/Extensions/scitedirector',
795 'IPython/testing/plugin',
796 ]
797
798 for fex in exclude:
799 if fex in filename: # substring
802 for pat in self.exclude_patterns:
803 if pat.search(filename):
800 804 #print '###>>> SKIP:',filename # dbg
801 805 return False
802 806
General Comments 0
You need to be logged in to leave comments. Login now