From df8aedba478231d0f411090f6f292db9b940511d Mon Sep 17 00:00:00 2001 From: holger krekel Date: Mon, 12 Oct 2009 11:28:47 +0200 Subject: [PATCH] adding the console-runtest helper as discussed on py-dev --HG-- branch : trunk --- contrib/runtesthelper.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 contrib/runtesthelper.py diff --git a/contrib/runtesthelper.py b/contrib/runtesthelper.py new file mode 100644 index 000000000..a3d7c7be4 --- /dev/null +++ b/contrib/runtesthelper.py @@ -0,0 +1,19 @@ +""" +this little helper allows to run tests multiple times +in the same process. useful for running tests from +a console. +""" +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))