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

Pierre Rouleau prouleau001 at gmail.com
Thu Nov 16 21:54:47 CET 2006


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



More information about the Pytest-dev mailing list