[Grok-dev] Easier test setup with new grok.testing
Uli Fouquet
uli at gnufix.de
Wed Jan 30 06:46:41 EST 2008
Hi there,
Wichert Akkerman wrote:
> 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__':
> > unittest.main(default='test_suite')
> >
> > 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?
Not with the current implementation, which only supports doctests. But
it should be not too difficult to do the same for normal python tests.
Is there demand for such an extension?
Kind regards,
--
Uli
More information about the Grok-dev
mailing list