[pypy-commit] pypy apptest-file: Use a separate flag for new-style apptests

rlamy pypy.commits at gmail.com
Thu Jul 25 15:16:09 EDT 2019


Author: Ronan Lamy <ronan.lamy at gmail.com>
Branch: apptest-file
Changeset: r97028:d7026dea7f27
Date: 2019-07-25 20:15 +0100
http://bitbucket.org/pypy/pypy/changeset/d7026dea7f27/

Log:	Use a separate flag for new-style apptests

diff --git a/pypy/conftest.py b/pypy/conftest.py
--- a/pypy/conftest.py
+++ b/pypy/conftest.py
@@ -45,13 +45,17 @@
 def pytest_configure(config):
     global option
     option = config.option
-    config.addinivalue_line('python_files', APPLEVEL_FN)
+    if config.getoption('direct_apptest') or not config.getoption('runappdirect'):
+        config.addinivalue_line('python_files', APPLEVEL_FN)
 
 def pytest_addoption(parser):
     group = parser.getgroup("pypy options")
     group.addoption('-A', '--runappdirect', action="store_true",
            default=False, dest="runappdirect",
-           help="run applevel tests directly on python interpreter (not through PyPy)")
+           help="run legacy applevel tests directly on python interpreter (not through PyPy)")
+    group.addoption('-D', '--direct-apptest', action="store_true",
+           default=False, dest="direct_apptest",
+           help="run applevel_XXX.py tests directly on host interpreter")
     group.addoption('--direct', action="store_true",
            default=False, dest="rundirect",
            help="run pexpect tests directly")
@@ -92,7 +96,7 @@
 
 def pytest_pycollect_makemodule(path, parent):
     if path.fnmatch(APPLEVEL_FN):
-        if parent.config.getoption('runappdirect'):
+        if parent.config.getoption('direct_apptest'):
             return
         from pypy.tool.pytest.apptest2 import AppTestModule
         rewrite = parent.config.getoption('applevel_rewrite')
@@ -196,6 +200,8 @@
                 appclass.obj.space = LazyObjSpaceGetter()
             appclass.obj.runappdirect = option.runappdirect
 
-
 def pytest_ignore_collect(path, config):
+    if (config.getoption('direct_apptest') and not path.isdir()
+            and not path.fnmatch(APPLEVEL_FN)):
+        return True
     return path.check(link=1)
diff --git a/pypy/module/_cppyy/test/conftest.py b/pypy/module/_cppyy/test/conftest.py
--- a/pypy/module/_cppyy/test/conftest.py
+++ b/pypy/module/_cppyy/test/conftest.py
@@ -41,17 +41,14 @@
 disabled = None
 
 def pytest_configure(config):
-    if config.getoption('runappdirect'):
-        return
+    if config.getoption('runappdirect') or config.getoption('direct_apptest'):
+        return       # "can't run dummy tests in -A"
     if py.path.local.sysfind('genreflex') is None:
         import pypy.module._cppyy.capi.loadable_capi as lcapi
         try:
             import ctypes
             ctypes.CDLL(lcapi.backend_library)
         except Exception as e:
-            if config.option.runappdirect:
-                return       # "can't run dummy tests in -A"
-
             # build dummy backend (which has reflex info and calls hard-wired)
             import os
             from rpython.translator.tool.cbuild import ExternalCompilationInfo


More information about the pypy-commit mailing list