Add files from the old svn, r101.
[matthijs/upstream/mobilegtd.git] / tests / test_all.py
diff --git a/tests/test_all.py b/tests/test_all.py
new file mode 100644 (file)
index 0000000..21c3aee
--- /dev/null
@@ -0,0 +1,36 @@
+import nose
+import os
+from nose.selector import Selector
+from nose.plugins import Plugin
+
+import unittest
+
+
+class MySelector(Selector):
+    def wantDirectory(self, dirname):
+        parts = dirname.split(os.path.sep)
+        return 'specs' in parts
+    def wantFile(self, filepath):
+        
+        # we want python modules under specs/
+        dirname,filename = os.path.split(filepath)
+        base, ext = os.path.splitext(filename)
+        return self.wantDirectory(dirname) and ext == '.py' and base[0:2] != '__'
+    def wantModule(self, module):
+        # wantDirectory and wantFile above will ensure that
+        # we never see an unwanted module
+        return True
+    def wantFunction(self, function):
+        # never collect functions
+        return False
+    def wantClass(self, cls):
+        # only collect TestCase subclasses
+        return issubclass(cls, unittest.TestCase)
+
+class UseMySelector(Plugin):
+    enabled = True
+    def configure(self, options, conf):
+        pass # always on
+    def prepareTestLoader(self, loader):
+        loader.selector = MySelector(loader.config)
+nose.main(plugins=[UseMySelector()])