only consider packages when searching for unit tests
authorStefan Behnel <scoder@users.berlios.de>
Mon, 28 Jul 2008 19:02:29 +0000 (21:02 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Mon, 28 Jul 2008 19:02:29 +0000 (21:02 +0200)
runtests.py

index 5310dd7a7eeaa3755adf98183c7d0dfed93ba9ea..bb5487a572db8cdee8fd2f63494a6a77de703eed 100644 (file)
@@ -287,7 +287,18 @@ def collect_unittests(path, suite, selectors):
 
     loader = unittest.TestLoader()
 
+    skipped_dirs = []
+
     for dirpath, dirnames, filenames in os.walk(path):
+        if dirpath != path and "__init__.py" not in filenames:
+            skipped_dirs.append(dirpath + os.path.sep)
+            continue
+        skip = False
+        for dir in skipped_dirs:
+            if dirpath.startswith(dir):
+                skip = True
+        if skip:
+            continue
         parentname = os.path.split(dirpath)[-1]
         if package_matches(parentname):
             for f in filenames: