[py-dev] Failing to manage test state of a module with py.test

Maciek Fijalkowski fijal at genesilico.pl
Thu Nov 16 22:04:02 CET 2006


Pierre Rouleau wrote:

>Hi all,
>
>Using the latest of py.test (svn 34683), I can't seem to be able to
>control a module test setup using setup_module() as described in
>section 2.15 of http://codespeak.net/py/current/doc/test.html
>
>The document gives the following example:
>
>def setup_module(module):
>    """ setup up any state specific to the execution
>        of the given module.
>    """
>
>Now, I am assuming that the the definition of setup_module() must be
>written /inside/ the test script that test the module-under-test
>tested, right?
>
>Second, I am also assuming that setup_module's argument is the name of
>the module-under-test.
>
>Given the above assumptions, if I write a test script to test roman.py
> would be called test_roman.py and would include
>
>def setup_module(roman):
>    print 'SETTING up roman for testing....'
>
>And if I ran py.test -s test_roman.py I should be able to see the
>printed output. I don't.
>
>So, what do i do wrong here?
>
>Thanks
>_______________________________________________
>py-dev mailing list
>py-dev at codespeak.net
>http://codespeak.net/mailman/listinfo/py-dev
>  
>
Hum. I cannot reproduce you problem (I can clearly see 'SETTING up 
roman...' just after [5024] and before any dots. Yes, this is supposed 
to go to main body of testing module and it receives module object 
itself (not a name)



More information about the Pytest-dev mailing list