From 99dfb8ad6521c13f7a60db3166f719da33742145 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Fri, 5 Nov 2010 23:37:31 +0100 Subject: [PATCH] reverse options ordering in Parser class instead of on PluginManager --- pytest/_core.py | 5 ----- pytest/plugin/config.py | 6 +++--- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pytest/_core.py b/pytest/_core.py index ffacf52e6..2bfe0308a 100644 --- 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 diff --git a/pytest/plugin/config.py b/pytest/plugin/config.py index bedf74f5a..c8ac679d8 100644 --- 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)