Skip to content

Command line parsing fails when path is a value for an option #906

@isaulv

Description

@isaulv

On Mac OS X 10.10.4 using the latest homebrew Python 2.7.10, and py.test 2.7.2, if type on the command line:
py.test --app ~/path/to/app --host http://localhost:4444 tests/mobile

I get the following error:

usage: py.test [options] [file_or_dir] [file_or_dir] [...]
py.test: error: unrecognized arguments: --app --host http://localhost:4444 tests/mobile

This seems to be an issue regardless of OS or Python version.

This only works if I put the path as a last option. But this defeats the purpose of having options that can be set in "any" order.

This is a section of my conftest.py:

def pytest_addoption(parser):
    parser.addoption('--host', action='store', help='Webdriver Remote Host')
    parser.addoption('--base_url', action='store', help='base URL')
    parser.addoption('--app', action='store', help='path to iOS app')
    parser.addoption('--android_app', action='store', help='path to Android app')

Things to note: A full path name works okay, but it seems that a ~ and a $varialbe will fail to parse.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugproblem that needs to be addressed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions