]> granicus.if.org Git - python/commitdiff
test_pyclbr goes nuts when a module contains code to try importing a class
authorPhillip J. Eby <pje@telecommunity.com>
Tue, 18 Apr 2006 01:39:25 +0000 (01:39 +0000)
committerPhillip J. Eby <pje@telecommunity.com>
Tue, 18 Apr 2006 01:39:25 +0000 (01:39 +0000)
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.

Lib/test/test_pyclbr.py

index 87572ca038e10d766724fc9e9ce6cbe3a3fc4c22..d2f8c768f002ec68c2defa3fc1f4fd86514f3506 100644 (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 ]