[pypy-commit] pypy pytest: move the test jit/translation graph viewing options to a own plugin to external code can use it

RonnyPfannschmidt noreply at buildbot.pypy.org
Tue Oct 2 16:59:01 CEST 2012


Author: Ronny Pfannschmidt <Ronny.Pfannschmidt at gmx.de>
Branch: pytest
Changeset: r57737:263956ca5435
Date: 2012-10-02 16:58 +0200
http://bitbucket.org/pypy/pypy/changeset/263956ca5435/

Log:	move the test jit/translation graph viewing options to a own plugin
	to external code can use it

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -46,8 +46,6 @@
 
 def pytest_addoption(parser):
     group = parser.getgroup("pypy options")
-    group.addoption('--view', action="store_true", dest="view", default=False,
-           help="view translation tests' flow graphs with Pygame")
     group.addoption('-A', '--runappdirect', action="store_true",
            default=False, dest="runappdirect",
            help="run applevel tests directly on python interpreter (not through PyPy)")
@@ -57,10 +55,6 @@
     group.addoption('-P', '--platform', action="callback", type="string",
            default="host", callback=_set_platform,
            help="set up tests to use specified platform as compile/run target")
-    group = parser.getgroup("JIT options")
-    group.addoption('--viewloops', action="store_true",
-           default=False, dest="viewloops",
-           help="show only the compiled loops")
 
 def pytest_sessionstart():
     # have python subprocesses avoid startup customizations by default
diff --git a/pypy/tool/pytest/viewerplugin.py b/pypy/tool/pytest/viewerplugin.py
new file mode 100644
--- /dev/null
+++ b/pypy/tool/pytest/viewerplugin.py
@@ -0,0 +1,26 @@
+"""
+    pypy.tool.pytest.viewerplugin
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+    this pytest plugin is support code for
+    testsuites using translation flowgraphs
+    or jit loop graphs.
+
+    it can be enabled by
+    
+    * adding the module name to pytest_plugins in a conftest
+    * putting "-p pypy.tool.pytest.viewerplugin"
+      into pytest.ini
+"""
+
+
+def pytest_addoption(parser):
+
+    group = parser.getgroup("pypy options")
+    group.addoption('--view', action="store_true", dest="view", default=False,
+           help="view translation tests' flow graphs with Pygame")
+
+    group = parser.getgroup("JIT options")
+    group.addoption('--viewloops', action="store_true",
+           default=False, dest="viewloops",
+           help="show only the compiled loops")
diff --git a/pytest.ini b/pytest.ini
--- a/pytest.ini
+++ b/pytest.ini
@@ -1,2 +1,4 @@
 [pytest]
-addopts = --assert=reinterp -rf
+addopts =
+    --assert=reinterp -rf
+    -p pypy.tool.pytest.viewerplugin


More information about the pypy-commit mailing list