Merge pull request #4966 from blueyed/fix-preparse
config: fix consider_preparse with missing argument to -p
This commit is contained in:
commit
15d608867d
|
@ -481,7 +481,10 @@ class PytestPluginManager(PluginManager):
|
|||
i += 1
|
||||
if isinstance(opt, six.string_types):
|
||||
if opt == "-p":
|
||||
parg = args[i]
|
||||
try:
|
||||
parg = args[i]
|
||||
except IndexError:
|
||||
return
|
||||
i += 1
|
||||
elif opt.startswith("-p"):
|
||||
parg = opt[2:]
|
||||
|
|
|
@ -313,6 +313,9 @@ class TestPytestPluginManagerBootstrapming(object):
|
|||
assert '"hello123"' in excinfo.value.args[0]
|
||||
pytestpm.consider_preparse(["-pno:hello123"])
|
||||
|
||||
# Handles -p without following arg (when used without argparse).
|
||||
pytestpm.consider_preparse(["-p"])
|
||||
|
||||
def test_plugin_prevent_register(self, pytestpm):
|
||||
pytestpm.consider_preparse(["xyz", "-p", "no:abc"])
|
||||
l1 = pytestpm.get_plugins()
|
||||
|
|
Loading…
Reference in New Issue