From 75ab487e4299310f2dd1faab64d758318c778ed7 2008-11-09 05:54:34 From: Fernando Perez Date: 2008-11-09 05:54:34 Subject: [PATCH] Fixes to testing system: ipdocetst plugin wasn't being properly loaded. --- diff --git a/IPython/testing/iptest.py b/IPython/testing/iptest.py index 262ef28..3c1e157 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) diff --git a/IPython/testing/plugin/Makefile b/IPython/testing/plugin/Makefile index 9d8157a..dd65022 100644 --- a/IPython/testing/plugin/Makefile +++ b/IPython/testing/plugin/Makefile @@ -36,8 +36,8 @@ deco: magic: plugin $(NOSE) IPython.Magic -ipipe: plugin - $(NOSE) IPython.Extensions.ipipe +excolors: plugin + $(NOSE) IPython.excolors iplib: plugin $(NOSE) IPython.iplib diff --git a/IPython/testing/plugin/ipdoctest.py b/IPython/testing/plugin/ipdoctest.py index 5971332..fc22d4d 100644 --- a/IPython/testing/plugin/ipdoctest.py +++ b/IPython/testing/plugin/ipdoctest.py @@ -688,6 +688,7 @@ class ExtensionDoctest(doctests.Doctest): self.globs = None self.extraglobs = None + def loadTestsFromExtensionModule(self,filename): bpath,mod = os.path.split(filename) modname = os.path.splitext(mod)[0] @@ -703,8 +704,8 @@ class ExtensionDoctest(doctests.Doctest): # a few modifications to control output checking. def loadTestsFromModule(self, module): - #print 'lTM',module # dbg - + #print '*** ipdoctest - lTM',module # dbg + if not self.matches(module.__name__): log.debug("Doctest doesn't want module %s", module) return @@ -733,8 +734,6 @@ class ExtensionDoctest(doctests.Doctest): def loadTestsFromFile(self, filename): - #print 'lTF',filename # dbg - if is_extension_module(filename): for t in self.loadTestsFromExtensionModule(filename): yield t @@ -761,7 +760,7 @@ class ExtensionDoctest(doctests.Doctest): Modified version that accepts extension modules as valid containers for doctests. """ - print 'Filename:',filename # dbg + #print '*** ipdoctest- wantFile:',filename # dbg # XXX - temporarily hardcoded list, will move to driver later exclude = ['IPython/external/', @@ -791,7 +790,7 @@ class IPythonDoctest(ExtensionDoctest): """ name = 'ipdoctest' # call nosetests with --with-ipdoctest enabled = True - + def configure(self, options, config): Plugin.configure(self, options, config)