Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

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

Closed
wants to merge 1 commit into from

2 participants

@minrk
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

@minrk minrk 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
@takluyver
Owner

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.

@minrk
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__).

@minrk minrk closed this pull request from a commit
@minrk minrk 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
@minrk minrk closed this in c956c22
@ellisonbg ellisonbg referenced this pull request from a commit
Commit has since been removed from the repository and is no longer available.
@mattvonrocketstein mattvonrocketstein referenced this pull request from a commit in mattvonrocketstein/ipython
@minrk minrk 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
e2d2de5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 2, 2011
  1. @minrk

    add wantDirectory to ipdoctest, so that directories will be checked f…

    minrk authored
    …or exclusion
    
    This prevents ImportErrors raised in `__init__` checks from causing a failure when they should have been excluded.
    
    closes gh-918
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 IPython/testing/plugin/ipdoctest.py
View
11 IPython/testing/plugin/ipdoctest.py
@@ -737,6 +737,17 @@ def wantFile(self,filename):
else:
return doctests.Doctest.wantFile(self,filename)
+ def wantDirectory(self, directory):
+ """Return whether the given directory should be scanned for tests.
+
+ Modified version that supports exclusions.
+ """
+
+ for pat in self.exclude_patterns:
+ if pat.search(directory):
+ return False
+ return True
+
class IPythonDoctest(ExtensionDoctest):
"""Nose Plugin that supports doctests in extension modules.
Something went wrong with that request. Please try again.