From 366ad68411fe603a52f5908122bcac280cd7d564 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Sat, 8 Nov 2008 21:54:34 -0800 Subject: [PATCH 1/5] Fixes to testing system: ipdocetst plugin wasn't being properly loaded. --- IPython/testing/iptest.py | 44 +++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 262ef28e2..3c1e1576e 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -1,4 +1,3 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- """IPython Test Suite Runner. """ @@ -18,28 +17,18 @@ def main(): warnings.filterwarnings('ignore', 'This will be removed soon. Use IPython.testing.util instead') - - # construct list of plugins, omitting the existing doctest plugin - plugins = [IPythonDoctest()] - for p in nose.plugins.builtin.plugins: - plug = p() - if plug.name == 'doctest': - continue - - #print 'adding plugin:',plug.name # dbg - plugins.append(plug) - - argv = sys.argv + ['--doctest-tests','--doctest-extension=txt', - '--detailed-errors', + argv = sys.argv + [ '--with-ipdoctest', + '--doctest-tests','--doctest-extension=txt', + '--detailed-errors', - # 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', - ] + # 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', + ] has_ip = False for arg in sys.argv: @@ -50,4 +39,15 @@ def main(): if not has_ip: argv.append('IPython') + # construct list of plugins, omitting the existing doctest plugin + plugins = [IPythonDoctest()] + for p in nose.plugins.builtin.plugins: + plug = p() + if plug.name == 'doctest': + continue + + #print '*** adding plugin:',plug.name # dbg + plugins.append(plug) + + TestProgram(argv=argv,plugins=plugins) From 07b2c09938b8d78a561b6d68a66846eb247d8c29 Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Tue, 10 Mar 2009 13:02:00 -0700 Subject: [PATCH 2/5] Update decorators and test scripts. --- IPython/testing/iptest.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 3c1e1576e..0a99b9991 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -30,13 +30,16 @@ def main(): '--exe', ] - has_ip = False + # Detect if any tests were required by explicitly calling an IPython + # submodule or giving a specific path + has_tests = False for arg in sys.argv: - if 'IPython' in arg: - has_ip = True + if 'IPython' in arg or arg.endswith('.py') or \ + (':' in arg and '.py' in arg): + has_tests = True break - - if not has_ip: + # If nothing was specifically requested, test full IPython + if not has_tests: argv.append('IPython') # construct list of plugins, omitting the existing doctest plugin @@ -49,5 +52,4 @@ def main(): #print '*** adding plugin:',plug.name # dbg plugins.append(plug) - TestProgram(argv=argv,plugins=plugins) From 55b455032b9a8dcf81a75d3d14327a0ffd7d9d7b Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Tue, 10 Mar 2009 22:49:08 -0700 Subject: [PATCH 3/5] Cleanup testing machinery. --- IPython/testing/iptest.py | 44 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 0a99b9991..9e4f74b94 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -1,15 +1,53 @@ # -*- coding: utf-8 -*- """IPython Test Suite Runner. + +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. """ +#----------------------------------------------------------------------------- +# Module imports +#----------------------------------------------------------------------------- + +# stdlib import sys import warnings -from nose.core import TestProgram +# third-party import nose.plugins.builtin +from nose.core import TestProgram +# Our own imports from IPython.testing.plugin.ipdoctest import IPythonDoctest +#----------------------------------------------------------------------------- +# 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', + 'IPython/testing/plugin', + ] + +#----------------------------------------------------------------------------- +# Functions and classes +#----------------------------------------------------------------------------- + def main(): """Run the IPython test suite. """ @@ -42,8 +80,8 @@ def main(): if not has_tests: argv.append('IPython') - # construct list of plugins, omitting the existing doctest plugin - plugins = [IPythonDoctest()] + # Construct list of plugins, omitting the existing doctest plugin. + plugins = [IPythonDoctest(EXCLUDE)] for p in nose.plugins.builtin.plugins: plug = p() if plug.name == 'doctest': From d2f86cc9a4cbaf69a5445a5cf0f8482c2a1b8b3e Mon Sep 17 00:00:00 2001 From: Fernando Perez Date: Sun, 15 Mar 2009 18:38:04 -0700 Subject: [PATCH 4/5] 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. --- IPython/testing/iptest.py | 1 - 1 file changed, 1 deletion(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 9e4f74b94..2deefeddb 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -41,7 +41,6 @@ EXCLUDE = ['IPython/external/', 'IPython/Extensions/clearcmd', 'IPython/Extensions/PhysicalQIn', 'IPython/Extensions/scitedirector', - 'IPython/testing/plugin', ] #----------------------------------------------------------------------------- From 842130bd17d2ae336e3aeb042992ae408e66f08f Mon Sep 17 00:00:00 2001 From: Brian Granger Date: Fri, 20 Mar 2009 21:18:16 -0700 Subject: [PATCH 5/5] Temporarily disabling the ipdoctest nose plugin. This plugin was causing problems with Twisted. We need to go through the plugin to find the source of the problem. For now, our test suite passes though. --- IPython/testing/iptest.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 2deefeddb..14f8eba11 100644 --- a/IPython/testing/iptest.py +++ b/IPython/testing/iptest.py @@ -54,7 +54,13 @@ def main(): warnings.filterwarnings('ignore', 'This will be removed soon. Use IPython.testing.util instead') - argv = sys.argv + [ '--with-ipdoctest', + 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. + # '--with-ipdoctest', '--doctest-tests','--doctest-extension=txt', '--detailed-errors',