Commits

Amaury Forgeot d'Arc  committed 0425573

My turn to remove some py.test deprecation warnings:
turn all these files into ConfestPlugins.

It seems that the test collection scans too many conftests:
python test_all.py translator/c/test
will process all test plugins from
translator/cli, translator/js and translator/jvm.

  • Participants
  • Parent commits 61da967

Comments (0)

Files changed (6)

File pypy/conftest.py

 
 class PyPyTestPlugin:
     def pytest_addoption(self, parser):
-        group = parser.addgroup("pypy option")
+        group = parser.addgroup("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",

File pypy/translator/cli/conftest.py

-import py
-
-Option = py.test.config.Option
-
-option = py.test.config.addoptions\
-         ("pypy-cli options", 
-
-          Option('--source', action="store_true", dest="source", default=False,
-                 help="only generate IL source, don't compile"),
-
-          Option('--wd', action="store_true", dest="wd", default=False,
-                 help="store temporary files in the working directory"),
-
-          Option('--stdout', action="store_true", dest="stdout", default=False,
-                 help="print the generated IL code to stdout, too"),
-
-          Option('--nostop', action="store_true", dest="nostop", default=False,
-                 help="don't stop on warning. The generated IL code could not compile"),
-
-          Option('--nowrap', action="store_true", dest="nowrap", default=False,
-                 help="don't wrap exceptions but let them to flow out of the entry point"),
-
-          Option('--verify', action="store_true", dest="verify", default=False,
-                 help="check that compiled executables are verifiable"),
-
-          Option('--norun', action='store_true', dest="norun", default=False,
-                 help="don't run the compiled executable"),
-
-          Option('--trace', action='store_true', dest='trace', default=False,
-                 help='Trace execution of generated code'),
-          )
-
-
-
+class ConftestPlugin:
+    def pytest_addoption(self, parser):
+        group = parser.addgroup("pypy-cli options")
+        group.addoption('--source', action="store_true", dest="source", default=False,
+                help="only generate IL source, don't compile")
+        group.addoption('--wd', action="store_true", dest="wd", default=False,
+                help="store temporary files in the working directory")
+        group.addoption('--stdout', action="store_true", dest="stdout", default=False,
+                help="print the generated IL code to stdout, too")
+        group.addoption('--nostop', action="store_true", dest="nostop", default=False,
+                help="don't stop on warning. The generated IL code could not compile")
+        group.addoption('--nowrap', action="store_true", dest="nowrap", default=False,
+                help="don't wrap exceptions but let them to flow out of the entry point")
+        group.addoption('--verify', action="store_true", dest="verify", default=False,
+                help="check that compiled executables are verifiable")
+        group.addoption('--norun', action='store_true', dest="norun", default=False,
+                help="don't run the compiled executable")
+        group.addoption('--trace', action='store_true', dest='trace', default=False,
+                help='Trace execution of generated code')

File pypy/translator/cli/option.py

-from pypy.translator.cli.conftest import option
+from pypy.conftest import option
 
 _defaultopt = dict(wd = False, source = False, nostop = False, stdout = False)
 

File pypy/translator/js/conftest.py

-import py
-
-Option = py.test.config.Option
-
-option = py.test.config.addoptions("pypy-ojs options", 
-        Option('--use-browser', action="store", dest="browser", type="string",
-               default="", help="run Javascript tests in your default browser"),
-        
-        Option('--tg', action="store_true", dest="tg", default=False,
-            help="Use TurboGears machinery for testing")
-    )
+class ConftestPlugin:
+    def pytest_addoption(self, parser):
+        group = parser.addgroup("pypy-ojs options")
+        group.addoption('--use-browser', action="store", dest="browser", type="string",
+                default="", help="run Javascript tests in your default browser")
+        group.addoption('--tg', action="store_true", dest="tg", default=False,
+                help="Use TurboGears machinery for testing")

File pypy/translator/jvm/conftest.py

-import py
+class ConftestPlugin:
+    def pytest_addoption(self, parser):
+        group = parser.addgroup("pypy-jvm options")
+        group.addoption('--java', action='store', dest='java', default='java',
+                help='Define the java executable to use')
+        group.addoption('--javac', action='store', dest='javac', default='javac',
+                help='Define the javac executable to use')
+        group.addoption('--jasmin', action='store', dest='java', default='java',
+                help='Define the jasmin script to use')
+        group.addoption('--noassemble', action='store_true', dest="noasm", default=False,
+                help="don't assemble jasmin files")
+        group.addoption('--package', action='store', dest='package', default='pypy',
+                help='Package to output generated classes into')
+##        group.addoption('--trace', action='store_true', dest='trace', default=False,
+##                help='Trace execution of generated code')
+        group.addoption('--byte-arrays', action='store_true', dest='byte-arrays',
+                default=False, help='Use byte arrays rather than native strings')
 
-Option = py.test.config.Option
-
-option = py.test.config.addoptions(
-    "pypy-jvm options",
-
-    Option('--java', action='store', dest='java', default='java',
-           help='Define the java executable to use'),
-    Option('--javac', action='store', dest='javac', default='javac',
-           help='Define the javac executable to use'),
-    Option('--jasmin', action='store', dest='java', default='java',
-           help='Define the jasmin script to use'),
-    Option('--noassemble', action='store_true', dest="noasm", default=False,
-           help="don't assemble jasmin files"),
-    Option('--package', action='store', dest='package', default='pypy',
-           help='Package to output generated classes into'),
-##    Option('--trace', action='store_true', dest='trace', default=False,
-##           help='Trace execution of generated code'),
-    Option('--byte-arrays', action='store_true', dest='byte-arrays',
-           default=False, help='Use byte arrays rather than native strings'),
-    )

File pypy/translator/jvm/option.py

-from pypy.translator.jvm.conftest import option
+from pypy.conftest import option
 
 # Not sure why this is needed.  Sure that it shouldn't be, even.
 _default_values = {