[py-svn] pytest commit 4bdabf614c76: reverse options ordering in Parser class instead of on PluginManager

commits-noreply at bitbucket.org commits-noreply at bitbucket.org
Sat Nov 6 09:57:01 CET 2010


# HG changeset patch -- Bitbucket.org
# Project pytest
# URL http://bitbucket.org/hpk42/pytest/overview
# User holger krekel <holger at merlinux.eu>
# Date 1288996651 -3600
# Node ID 4bdabf614c7658b422eba78d787f8bce41b81a2d
# Parent  125c0136ba20fa7c651de76a4c679b1c59440487
reverse options ordering in Parser class instead of on PluginManager

--- a/pytest/plugin/config.py
+++ b/pytest/plugin/config.py
@@ -53,12 +53,12 @@ class Parser:
 
     def parse(self, args):
         self.optparser = optparser = MyOptionParser(self)
-        groups = self._groups + [self._anonymous]
+        groups = list(reversed(self._groups)) + [self._anonymous]
         for group in groups:
             if group.options:
                 desc = group.description or group.name
                 optgroup = py.std.optparse.OptionGroup(optparser, desc)
-                optgroup.add_options(group.options)
+                optgroup.add_options(reversed(group.options))
                 optparser.add_option_group(optgroup)
         return self.optparser.parse_args([str(x) for x in args])
 
@@ -304,7 +304,7 @@ class Config(object):
         self.pluginmanager.consider_env()
         self.pluginmanager.consider_preparse(args)
         self._setinitialconftest(args)
-        self.pluginmanager.do_addoption(self._parser)
+        self.hook.pytest_addoption(parser=self._parser)
 
     def _checkversion(self):
         minver = self.inicfg.get('minversion', None)

--- a/pytest/_core.py
+++ b/pytest/_core.py
@@ -180,11 +180,6 @@ class PluginManager(object):
             for hint in self._hints:
                 tw.line("hint: %s" % hint)
 
-    def do_addoption(self, parser):
-        mname = "pytest_addoption"
-        methods = reversed(self.listattr(mname))
-        MultiCall(methods, {'parser': parser}).execute()
-
     def do_configure(self, config):
         assert not hasattr(self, '_config')
         self._config = config



More information about the pytest-commit mailing list