Announcing Testido automatic unittest TestSuite generator
For a project I’m working on, I didn’t want to introduce a dependency on py.test. I also didn’t want to manually write test suites myself. So, here’s Testido: a simple unittest extension that easily hooks in to however you’re testing now and eliminates the need to manually write suites.
Through the wonder of setuptools, Testido can be installed trivially with easy_install.
The simplest usage looks like this:
from setuptools import setup
setup(name='foo',
version='1.0',
packages=['foo'],
)
Running “python setup.py testido” with that setup file will run all of the tests it can find in the “foo” package. Doesn’t get much easier than that, does it?
Alternatively, you can create a TestSuite that can be used by other tools like this:
from testido import collector
suite = collector.Collector("foo")
As I point out in the docs, Testido is not a full substitute for py.test or Testoob.
But, if you are using the stdlib’s unittest for whatever reason, it can make your life easier.


Kudos!
Thanks, Phillip! It was actually your post about unittest on dirtsimple that even made me think of doing this.
Very nice! I appreciate that you made the collector module *not* dependent on setuptools
I ran collector.Collector(”cherrypy”), btw, and got nothing, because none of the TestCase classes in the CherryPy test suite have names starting with “test”. Would you consider removing lines 88-89 from collector.py (”if not candidate.lower().startswith(”test”): continue”)? Commenting those lines out worked fine.
Glad you find it helpful!
You’re right, of course… anything that is a subclass of TestCase should be collected, regardless of the name. I started down that path, because the py.test collection rules don’t stipulate what the class should be, they just put a requirement on the name. Since I don’t even have random class collection, I can take the name check out for classes and just worry about the isinstance check for now.
However, the change that you describe will pick up all extraneous functions that may appear in the test module. I just need to move the name check down to specific check for each functon whether the name starts with test.
The next release of Testido will take care of this. Thanks for the report!