From 49d46a0059e5a167469a8c702564b41510ed1995 Mon Sep 17 00:00:00 2001 From: Buck Golemon Date: Thu, 24 Sep 2015 16:10:01 -0700 Subject: [PATCH] an ugly patch to fix all but the most important part =/ --- _pytest/config.py | 6 +++--- testing/test_config.py | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/_pytest/config.py b/_pytest/config.py index 0495aa21f..525f0fbf2 100644 --- a/_pytest/config.py +++ b/_pytest/config.py @@ -879,7 +879,7 @@ class Config(object): def fromdictargs(cls, option_dict, args): """ constructor useable for subprocesses. """ config = get_config() - config._preparse(args, addopts=False) + config.parse(args, addopts=False) config.option.__dict__.update(option_dict) for x in config.option.plugins: config.pluginmanager.consider_pluginarg(x) @@ -947,14 +947,14 @@ class Config(object): self.inicfg.config.path, self.inicfg.lineof('minversion'), minver, pytest.__version__)) - def parse(self, args): + def parse(self, args, addopts=True): # parse given cmdline arguments into this config object. assert not hasattr(self, 'args'), ( "can only parse cmdline args at most once per Config object") self._origargs = args self.hook.pytest_addhooks.call_historic( kwargs=dict(pluginmanager=self.pluginmanager)) - self._preparse(args) + self._preparse(args, addopts=addopts) # XXX deprecated hook: self.hook.pytest_cmdline_preparse(config=self, args=args) args = self._parser.parse_setoption(args, self.option) diff --git a/testing/test_config.py b/testing/test_config.py index 601985e19..981138e75 100644 --- a/testing/test_config.py +++ b/testing/test_config.py @@ -266,7 +266,6 @@ class TestConfigAPI: class TestConfigFromdictargs: - @pytest.mark.xfail(reason="fromdictargs currently broken #1060") def test_basic_behavior(self): from _pytest.config import Config option_dict = { @@ -282,7 +281,6 @@ class TestConfigFromdictargs: assert config.option.foo == 'bar' assert config.args == args - @pytest.mark.xfail(reason="fromdictargs currently broken #1060") def test_origargs(self): """Show that fromdictargs can handle args in their "orig" format""" from _pytest.config import Config