You can also look at Nose , which will open the tests without using a fixed-name filename agreement.
You can bypass the regex used to filter files in the nose with the following code. Create a python module (i.e. my_nosetests.py )
import nose from nose.plugins.base import Plugin class ExtensionPlugin(Plugin): name = "ExtensionPlugin" def options(self, parser, env): Plugin.options(self,parser,env) def configure(self, options, config): Plugin.configure(self, options, config) self.enabled = True def wantFile(self, file): return file.endswith('.py') def wantDirectory(self,directory): return True def wantModule(self,file): return True if __name__ == '__main__': includeDirs = ["-w", ".", ".."] nose.main(addplugins=[ExtensionPlugin()], argv=sys.argv.extend(includeDirs))
Now run my_nosetests.py as if you were running nosetests and you should have your tests. Keep in mind that you are actually loading all modules and looking for tests for them. Beware of any side effect of module loading.
source share