Skip to content

-p does not pick up value if there is no space #3532

@xmo-odoo

Description

@xmo-odoo

pytest 3.6.0 on CPython 3.6.5, OSX 10.11.6

Observed: For most options, the space between the short option name and its value is optional, but -p behaves stangely: -pfoo does not pick up the plugin, but it doesn't print any warning or error either, while -p foo works properly. -pno:foo seems to behave the same way (no warning or error but doesn't do anything either).

Expected: -pfoo should either lead to foo being properly loaded, or it should raise some sort of error.

Example:

$ echo 'def pytest_addoption(parser): print("loaded")' > plugin.py
$ python -mpytest -s -p plugin -k xyz
loaded
=========================== test session starts ============================
platform darwin -- Python 3.6.5, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
sensitiveurl: .*
Using --random-order-bucket=module
Using --random-order-seed=857883

rootdir: [snip], inifile:
plugins: variables-1.7.1, selenium-1.12.0, random-order-0.7.0, metadata-1.7.0, html-1.18.0, cov-2.5.1, base-url-1.4.1
[snip…]
$ python -mpytest -s -pplugin -k xyz
=========================== test session starts ============================
platform darwin -- Python 3.6.5, pytest-3.6.0, py-1.5.3, pluggy-0.6.0
sensitiveurl: .*
Using --random-order-bucket=module
Using --random-order-seed=465375

rootdir: [snip], inifile:
plugins: variables-1.7.1, selenium-1.12.0, random-order-0.7.0, metadata-1.7.0, html-1.18.0, cov-2.5.1, base-url-1.4.1

Metadata

Metadata

Labels

topic: configrelated to config handling, argument parsing and config filetype: bugproblem that needs to be addressed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions