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
import py, sys def pytest(argv=None): if argv is None: argv = [] try: sys.argv[1:] = argv py.cmdline.pytest() except SystemExit: pass # we need to reset the global py.test.config object py._com.comregistry = py._com.comregistry.__class__([]) py.test.config = py.test.config.__class__( pluginmanager=py.test._PluginManager(py._com.comregistry))
_______________________________________________ py-dev mailing list py-dev@codespeak.net http://codespeak.net/mailman/listinfo/py-dev