[py-dev] py.test from inside the python console

holger krekel holger at merlinux.eu
Thu Oct 8 13:48:17 CEST 2009


and here is the file actually attached.

holger

On Thu, Oct 08, 2009 at 13:47 +0200, holger krekel wrote:

> Hi Fede,
> 
> On Wed, Oct 07, 2009 at 17:21 +1100, Fede Naum wrote:
> > Hello, I did a search by subject in the py-dev Archives and could not found
> > any thread about that.
> > I guess it is because the documentation clearly say "py.test is a *command
> > line tool* to collect and run automated tests".
> 
> somewhat true :)
> 
> > I'm using as it is for some integration test but now I want to use it to run
> > them from inside a python shell
> > Is there a way to run the autodiscovery + run the test + get the report from
> > inside a python console?
> 
> I've attached a small "runtesthelper.py" script whose "pytest" function
> you could import into your environment, best through PYTHONSTARTUP. 
> It's a bit of a hack because of "py.test.config" has some global state 
> (using that config object is btw deprecated).  
> 
> > Why do I need that?
> > I need it because I have to do it from inside a special console (the python
> > console provided with Maya -
> > http://usa.autodesk.com/adsk/servlet/pc/index?siteID=123112&id=13577897) so
> > I do not have any command line environmet to run py.test
> 
> makes sense.  Let us now if the above works well enough and/or
> what you'd like to see.  I'd like to see usage-from-the shell
> get fully supported by default.
> 
> best,
> holger

-- 
Metaprogramming, Python, Testing: http://tetamap.wordpress.com
Python, PyPy, pytest contracting: http://merlinux.eu 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: runtesthelper.py
Type: text/x-python
Size: 409 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20091008/f77f4a8d/attachment.py>


More information about the Pytest-dev mailing list