Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pytest options with more than one metavar don't have the correct help #2004

Closed
okulynyak opened this issue Oct 17, 2016 · 5 comments
Closed

Pytest options with more than one metavar don't have the correct help #2004

okulynyak opened this issue Oct 17, 2016 · 5 comments
Labels

Comments

@okulynyak
Copy link

@okulynyak okulynyak commented Oct 17, 2016

automated_test_scripts\tests>pytest -v -s --firefox-preference="browser.helperApps.neverAsk.openFile"="application/excel" test_login.py"
i got error:
usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: argument --firefox-preference: expected 2 argument(s).
I tried different combination and all the time i got the same error.
I using a synthax in command line from >pytest -h

Here is link for temporary resolve of this problem: pytest-dev/pytest-selenium#86 (comment)

Thanks for your time

@davehunt
Copy link
Contributor

@davehunt davehunt commented Oct 17, 2016

To give a little more context, pytest-selenium uses a command line option that appends values to a list, and expects two arguments. In the --help text this is indicated by the --name=value1=value2 prompt, however this doesn't work as expected. It is necessary to use --name value1 value2 instead.

@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Oct 19, 2016

Thanks @davehunt and @okulynyak for the report.

Not sure how easy it is to fix this though, pytest's argument parsing is quite complicated (I think).

@The-Compiler
Copy link
Member

@The-Compiler The-Compiler commented Oct 19, 2016

FWIW --name=value1=value2 for an argument with two values seems like an odd syntax to me, does that work with other tools? IMHO the right thing to do here is just fixing the --help output to show --name value1 value2.

@okulynyak
Copy link
Author

@okulynyak okulynyak commented Oct 19, 2016

Hi. As for me, i vote for The-Compiler says: "IMHO the right thing to do here is just fixing the --help output to show --name value1 value2."
it is a weird a little bit to see something like --something=something=something

@nicoddemus
Copy link
Member

@nicoddemus nicoddemus commented Oct 19, 2016

Oh right sorry, TBH I just glanced at the issue before bed and thought we would have to change the parsing of the option. My bad.

I agree, we should just update the help message.

@nicoddemus nicoddemus changed the title Pytest options are not parsed correctly (option --firefox-preferences=name=value) Pytest options with more than one metavar don't have the correct help Oct 20, 2016
nicoddemus added a commit to nicoddemus/pytest that referenced this issue Oct 20, 2016
nicoddemus added a commit to nicoddemus/pytest that referenced this issue Oct 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

4 participants