[Grok-dev] Easier test setup with new grok.testing
wichert at wiggy.net
Wed Jan 30 02:55:50 EST 2008
Previously Uli Fouquet wrote:
> 2) Setup testing.
> Create a Python file whose name starts with 'tests' in your app. For
> example `tests.py`, `tests_myapp.py` or `tests_setup.py`.
> Populate this file with your tests' setup.
> This normally is a bit complicated and you have to remember several
> things/commands/options etc. The shortest setup you can use now looks
> like this::
> import unittest
> import grok
> import cave # The package that contains the doctest files
> def test_suite():
> setup = grok.testing.UnitTestSetup(cave)
> return setup.getTestSuite()
> if __name__ == '__main__':
> This will search your ``cave`` package (including subdirectories)
> for any .rst or .txt files, that contain the testlayer marker string
> as mentioned above and will register the files as doctests.
I'm assuming something just as simple will work for normal python tests
instead of doctests?
Wichert Akkerman <wichert at wiggy.net> It is simple to make things.
http://www.wiggy.net/ It is hard to make things simple.
More information about the Grok-dev