test_pyclbr goes nuts when a module contains code to try importing a class

and provide a substitute if the import fails, because pyclbr sees the
class definition.  Changed to ignore such cases' base classes and methods,
since they will not match.
This commit is contained in:
Phillip J. Eby 2006-04-18 01:39:25 +00:00
parent 9582c148b6
commit 742cd24c02
1 changed files with 3 additions and 0 deletions

View File

@ -95,6 +95,9 @@ class PyclbrTest(TestCase):
self.assert_(isinstance(py_item, (FunctionType, BuiltinFunctionType)))
else:
self.failUnless(isinstance(py_item, (ClassType, type)))
if py_item.__module__!=moduleName:
continue # skip classes that came from somewhere else
real_bases = [base.__name__ for base in py_item.__bases__]
pyclbr_bases = [ getattr(base, 'name', base)
for base in value.super ]