an ugly patch to fix all but the most important part =/

This commit is contained in:
Buck Golemon 2015-09-24 16:10:01 -07:00
parent 616d8251f3
commit 49d46a0059
2 changed files with 3 additions and 5 deletions

View File

@ -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)

View File

@ -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