[Grok-dev] Re: Testing a container which uses a custom NameChooser

Martijn Faassen faassen at startifact.com
Wed Aug 1 13:56:42 EDT 2007


Hey,

> Yes, event testing needs to be setup. Check grok/tests/test_grok.py.

We definitely need to make this easier, by providing a very simple API 
or actually doing it automatically when you test with Grok somehow.

> You could use test_grok set up directly in your tests:
> 
> from grok.test import test_grok
> 
> def test_suite():
>     modules = ['app', 'pac', 'book']
>     suite = unittest.TestSuite()
>     for module in modules:
>         module_name = 'kirbi.' + module
>         test = doctest.DocTestSuite(module_name,
>                         setUp=test_grok.setUpZope,
>                         tearDown=test_grok.cleanUpZope)
>         suite.addTest(test)
>     return suite
> 
> test_grok.setUpZope set ups event testing for you.

Hm, I recommend against reusing anything from 'grok.test', as it's 
really test code that might change at some point. For instance, I hope 
to eventually rewrite the Grok tests to have no more separation between 
grokked module and tests themselves, as martian now allows you to grok 
individual components from a doctest.

Regards,

Martijn



More information about the Grok-dev mailing list