Skip to content
This repository

add wantDirectory to ipdoctest, so that directories will be checked for e #968

Closed
wants to merge 1 commit into from

2 participants

Min RK Thomas Kluyver
Min RK
Owner

add wantDirectory to ipdoctest, so that directories will be checked for exclusion

This prevents ImportErrors raised in __init__ checks from causing a failure when they should have been excluded.

closes gh-918

Min RK add wantDirectory to ipdoctest, so that directories will be checked f…
…or exclusion

This prevents ImportErrors raised in `__init__` checks from causing a failure when they should have been excluded.

closes gh-918
c3bd3dc
Thomas Kluyver
Collaborator

I'm not familiar with nose's architecture, but it looks OK (and I assume you've tested it). Although I might have used the any() function to do the same thing.

Min RK
Owner

Thanks, merging - any() does make sense, and might be trivially cleaner (though technically less efficient).

This code is just copied/pasted from directly above - it's exactly the same as the file exclusion, just in the separate method that is used for directories (which appears to be the only way to protect code in __init__).

Min RK minrk closed this pull request from a commit November 02, 2011
Min RK add wantDirectory to ipdoctest, so that directories will be checked f…
…or exclusion

This prevents ImportErrors raised in `__init__` checks from causing a failure when they should have been excluded.

closes gh-918
closes gh-968
c956c22
Min RK minrk closed this in c956c22 November 09, 2011
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
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.

Nov 02, 2011
Min RK add wantDirectory to ipdoctest, so that directories will be checked f…
…or exclusion

This prevents ImportErrors raised in `__init__` checks from causing a failure when they should have been excluded.

closes gh-918
c3bd3dc
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 0 deletions. Show diff stats Hide diff stats

  1. 11  IPython/testing/plugin/ipdoctest.py
11  IPython/testing/plugin/ipdoctest.py
@@ -737,6 +737,17 @@ def wantFile(self,filename):
737 737
         else:
738 738
             return doctests.Doctest.wantFile(self,filename)
739 739
 
  740
+    def wantDirectory(self, directory):
  741
+        """Return whether the given directory should be scanned for tests.
  742
+
  743
+        Modified version that supports exclusions.
  744
+        """
  745
+
  746
+        for pat in self.exclude_patterns:
  747
+            if pat.search(directory):
  748
+                return False
  749
+        return True
  750
+
740 751
 
741 752
 class IPythonDoctest(ExtensionDoctest):
742 753
     """Nose Plugin that supports doctests in extension modules.
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.