Permalink
Browse files

Only discover things that are actually part of the module, not things…

… that are imported.
  • Loading branch information...
1 parent 0c23732 commit 5c9e935fda4d63fa0e2a03ead4dc53aefe2ddbc7 @EvanKrall EvanKrall committed Apr 24, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 testify/test_discovery.py
@@ -13,6 +13,7 @@
# limitations under the License.
+import inspect
import os
import time
import types
@@ -121,7 +122,7 @@ def discover_inner(locator, suites=None):
module_suites = getattr(test_module, '_suites', [])
for member_name in dir(test_module):
obj = getattr(test_module, member_name)
- if isinstance(obj, types.TypeType):
+ if isinstance(obj, types.TypeType) and inspect.getmodule(obj) == test_module:
for test_case_class in discover_inner(obj, suites + module_suites):
yield test_case_class

0 comments on commit 5c9e935

Please sign in to comment.