[pytest-dev] command line options not working?

Derek Sisson philosophe at gmail.com
Sat Jul 28 18:12:30 EDT 2018


I've been using command line options for years, but they no longer work for
me. I get the message "unrecognized arguments".

As a sanity check, I used the example from the documentation on
https://docs.pytest.org/en/latest/example/simple.html?highlight=addoption

~~~~~
import pytest


def pytest_addoption(parser):
    parser.addoption(
        "--cmdopt", action="store", default="type1", help="my option: type1
or type2"
    )


@pytest.fixture
def cmdopt(request):
    return request.config.getoption("--cmdopt")

~~~~~

(v3)$ pytest --cmdopt=type2

usage: pytest [options] [file_or_dir] [file_or_dir] [...]

pytest: error: unrecognized arguments: --cmdopt=type2

  inifile: None

  rootdir: /Users/derek/dev/example/example

​I'm using pytest-3.6.4 on OSX Sierra
​


-- 
thanks,
--derek
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pytest-dev/attachments/20180728/9c70aa9a/attachment.html>


More information about the pytest-dev mailing list