Skip to content
This repository

BF - allow nose with-doctest setting in environment #683

Closed
wants to merge 1 commit into from

2 participants

Matthew Brett Fernando Perez
Matthew Brett

IPDoctest replaces the normal doctest plugin. Previously we did this by
initializing the builtin plugins but skipping the doctest plugin.
However, if the user has a noserc file with 'with-doctest=1' or the
environment variable 'NOSE_WITH_DOCTEST', then nose will try and
initialize the doctest plugin when it isn't there, and barf. This
commit defers the removal of the doctest plugin to the configuration
stage, so doctest can be enabled before it is thrown away by us.

Matthew Brett BF - allow nose with-doctest setting in environment
IPDoctest replaces the normal doctest plugin.  Previously we did this by
initializing the builtin plugins but skipping the doctest plugin.
However, if the user has a noserc file with 'with-doctest=1' or the
environment variable 'NOSE_WITH_DOCTEST', then nose will try and
initialize the doctest plugin when it isn't there, and barf.  This
commit defers the removal of the doctest plugin to the configuration
stage, so doctest can be enabled before it is thrown away by us.
718b2d2
Fernando Perez
Owner

Great, thanks! Pushed (with a rebase to avoid the merge handle for a single commit.)

Fernando Perez fperez closed this August 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Aug 06, 2011
Matthew Brett BF - allow nose with-doctest setting in environment
IPDoctest replaces the normal doctest plugin.  Previously we did this by
initializing the builtin plugins but skipping the doctest plugin.
However, if the user has a noserc file with 'with-doctest=1' or the
environment variable 'NOSE_WITH_DOCTEST', then nose will try and
initialize the doctest plugin when it isn't there, and barf.  This
commit defers the removal of the doctest plugin to the configuration
stage, so doctest can be enabled before it is thrown away by us.
718b2d2
This page is out of date. Refresh to see the latest.
12  IPython/testing/iptest.py
@@ -355,19 +355,13 @@ def run_iptest():
355 355
         # for nose >= 0.11, though unfortunately nose 0.10 doesn't support it.
356 356
         argv.append('--traverse-namespace')
357 357
 
358  
-    # Construct list of plugins, omitting the existing doctest plugin, which
359  
-    # ours replaces (and extends).
  358
+    # use our plugin for doctesting.  It will remove the standard doctest plugin
  359
+    # if it finds it enabled
360 360
     plugins = [IPythonDoctest(make_exclude()), KnownFailure()]
361  
-    for p in nose.plugins.builtin.plugins:
362  
-        plug = p()
363  
-        if plug.name == 'doctest':
364  
-            continue
365  
-        plugins.append(plug)
366  
-
367 361
     # We need a global ipython running in this process
368 362
     globalipapp.start_ipython()
369 363
     # Now nose can run
370  
-    TestProgram(argv=argv, plugins=plugins)
  364
+    TestProgram(argv=argv, addplugins=plugins)
371 365
 
372 366
 
373 367
 def run_iptestall():
6  IPython/testing/plugin/ipdoctest.py
@@ -640,6 +640,9 @@ def options(self, parser, env=os.environ):
640 640
 
641 641
     def configure(self, options, config):
642 642
         Plugin.configure(self, options, config)
  643
+        # Pull standard doctest plugin out of config; we will do doctesting
  644
+        config.plugins.plugins = [p for p in config.plugins.plugins
  645
+                                  if p.name != 'doctest']
643 646
         self.doctest_tests = options.doctest_tests
644 647
         self.extension = tolist(options.doctestExtension)
645 648
 
@@ -783,6 +786,9 @@ def options(self, parser, env=os.environ):
783 786
     def configure(self, options, config):
784 787
         #print "Configuring nose plugin:", self.name # dbg
785 788
         Plugin.configure(self, options, config)
  789
+        # Pull standard doctest plugin out of config; we will do doctesting
  790
+        config.plugins.plugins = [p for p in config.plugins.plugins
  791
+                                  if p.name != 'doctest']
786 792
         self.doctest_tests = options.ipdoctest_tests
787 793
         self.extension = tolist(options.ipdoctest_extension)
788 794
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.