X-Git-Url: https://git.stderr.nl/gitweb?a=blobdiff_plain;f=tests%2Ftest_all.py;fp=tests%2Ftest_all.py;h=21c3aee15cae4875394626b796e15abe1ea7c22f;hb=826cc2e9923c858d3c6a86c04f371cfb326e1728;hp=0000000000000000000000000000000000000000;hpb=44f7fa2ef41d54548aa800b2bb71a886261c5046;p=matthijs%2Fupstream%2Fmobilegtd.git diff --git a/tests/test_all.py b/tests/test_all.py new file mode 100644 index 0000000..21c3aee --- /dev/null +++ b/tests/test_all.py @@ -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()])