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 · Fixed by #2019
Closed

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

okulynyak opened this issue Oct 17, 2016 · 5 comments · Fixed by #2019
Labels
type: bug problem that needs to be addressed

Comments

@okulynyak
Copy link

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

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

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).

@nicoddemus nicoddemus added the type: bug problem that needs to be addressed label Oct 19, 2016
@The-Compiler
Copy link
Member

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 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

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug problem that needs to be addressed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants