From c956c22659187a314953c9a7099d7d3876581795 2011-11-10 03:25:11 From: MinRK Date: 2011-11-10 03:25:11 Subject: [PATCH] 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 closes gh-968 --- diff --git a/IPython/testing/plugin/ipdoctest.py b/IPython/testing/plugin/ipdoctest.py index ca63bcb..6948aa3 100644 --- a/IPython/testing/plugin/ipdoctest.py +++ b/IPython/testing/plugin/ipdoctest.py @@ -737,6 +737,17 @@ class ExtensionDoctest(doctests.Doctest): 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.