[py-dev] py.test api - Running tests in a module object?

Sridhar Ratnakumar sridharr at activestate.com
Thu Aug 5 22:46:14 CEST 2010


I am trying to run py.test on a given module object dynamically.

     mod = __import__('company.foo.somemod')
     py.test.run(mod)

A quick glance in the py.test source doesn't seem like a trivial thing. 
IPython introspection did not give me any clue either.

Is there a way to do this at all? I did try 
py.test.cmdline.main(['...']), but that accepts only file path, not the 
Python module object itself.

-srid



More information about the Pytest-dev mailing list