[py-svn] py-trunk commit 16b15d5f3c9e: adding the console-runtest helper as discussed on py-dev

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Mon Oct 12 16:08:19 CEST 2009


# HG changeset patch -- Bitbucket.org
# Project py-trunk
# URL http://bitbucket.org/hpk42/py-trunk/overview/
# User holger krekel <holger at merlinux.eu>
# Date 1255339727 -7200
# Node ID 16b15d5f3c9ef9ea02c37d86f1f961d49d6e762f
# Parent eefec6c36925a832818b091e742705939557d505
adding the console-runtest helper as discussed on py-dev

--- /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))



More information about the pytest-commit mailing list