runtests.py (was: Merge request)

Sam Ruby rubys at intertwingly.net
Wed May 3 22:00:40 EST 2006


Mary Gardiner wrote:
> I've been executing the test suite under planet/tests by doing this:
> 
> $ cd [branch]
> $ trial planet
> 
> trial is the Twisted test suite runner, and it finds the tests directory
> and excecutes as appropriate. This has two nice features: colourful
> error reporting, and no need for a custom PYTHONPATH.
> 
> This is all very nice, but it's more traditional to make the tests
> directly executable. Thus, this branch.
> 
> It should apply directly after
> http://users.puzzling.org/users/mary/bzr/planet/branche

s/original-url-tracking/

Not as colorful, but try placing the following into runtests.py:

----
import glob, trace, unittest

# find all of the planet test modules
modules = map(trace.fullmodname, glob.glob('planet/tests/test_*.py'))

# load all of the tests into a suite
suite = unittest.TestLoader().loadTestsFromNames(modules)

# run test suite
unittest.TextTestRunner().run(suite)
----

- Sam Ruby


More information about the devel mailing list