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

Issue: 3103 - Fix UsageError raised when specifying config override options followed by test path #3133

Closed
wants to merge 8 commits into from

Conversation

arcoyle
Copy link

@arcoyle arcoyle commented Jan 20, 2018

Thanks for submitting a PR, your contribution is really appreciated!

Here's a quick checklist that should be present in PRs:

  • Add a new news fragment into the changelog folder
    • name it $issue_id.$type for example (588.bugfix)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of removal, feature, bugfix, vendor, doc or trivial
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."
  • Target: for bugfix, vendor, doc or trivial fixes, target master; for removals or features target features;
  • Make sure to include reasonable tests for your change if necessary

Unless your change is a trivial or a documentation fix (e.g., a typo or reword of a small section) please:

  • Add yourself to AUTHORS, in alphabetical order;

@arcoyle
Copy link
Author

arcoyle commented Jan 20, 2018

#3103

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 92.561% when pulling 4b92113 on arcoyle:issue-3103 into 6213746 on pytest-dev:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 92.561% when pulling 68c4268 on arcoyle:issue-3103 into 6213746 on pytest-dev:master.

@coveralls
Copy link

coveralls commented Jan 20, 2018

Coverage Status

Coverage increased (+0.002%) to 92.561% when pulling 79e5350 on arcoyle:issue-3103 into 6213746 on pytest-dev:master.

@nicoddemus
Copy link
Member

Thanks @arcoyle for the PR!

Great work, just took the liberty of improving the test and changelog entry a bit.

@nicoddemus
Copy link
Member

While playing with it I realized that the problem lies a little deeper.

The -o option is configured with nargs='*', but this means that any argument after -o will be swallowed by it, even if it is a test path:

pytest -o foo=1 bar=1 /path/to/test

In this case -o will contain ["value=1", "bar=1", "/path/to/test"] which is clearly not we want.

I don't see any way to fix this other than changing how the command line is parsed, so each option must be passed with -o as well:

pytest -o foo=1 -o bar=1 /path/to/test

I have some local changes that I intend to push to this branch to fix this, meanwhile let's keep it on hold.

Copy link
Member

@nicoddemus nicoddemus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Keep it on hold for now

@arcoyle
Copy link
Author

arcoyle commented Jan 23, 2018

@nicoddemus
Well spotted i didn't take into account the affect of that. Lesson learned for me. I'll keep an eye out for other issues to help on where possible. Thanks for the help on this one!

@nicoddemus
Copy link
Member

Well spotted i didn't take into account the affect of that.

Not at all, that bug has always been there since the introduction of -o. 😬

I'll keep an eye out for other issues to help on where possible.

Awesome, thanks!

@nicoddemus
Copy link
Member

Superseded by #3147: I had to rebase this on features and change the target so it seemed more appropriate to open a new PR, but I did keep the history intact.

Thanks @arcoyle and @atoolan for tackling this in the first place!

@nicoddemus nicoddemus closed this Jan 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants