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

Disallow abbreviated command-line options #5467

Closed
wants to merge 1 commit into from

Conversation

Zac-HD
Copy link
Member

@Zac-HD Zac-HD commented Jun 22, 2019

This was previously allowed where the ArgumentParser thought it was unambigious, because this could be incorrect due to delayed parsing of options for plugins.

Fixes #1149, fixes #3413, and fixes #4009 - it's been a known problem for quite a while, but this fix is only available on Python 3.5+... which means we can finally do it!

@Zac-HD
Copy link
Member Author

Zac-HD commented Jun 22, 2019

Ah, heck. https://bugs.python.org/issue26967 allow_abbrev=False also disables combining short options, such as -vv. Yep.

I guess someone needs to patch that - maybe add a separate allow_combined_flags option? - and then we wait for Pytest to drop 3.8 support 😭

@pytest-dev pytest-dev deleted a comment from codecov bot Jun 22, 2019
@nicoddemus
Copy link
Member

nicoddemus commented Jun 22, 2019

Bummer, 5.0 would be perfect for this breaking change...

@Zac-HD
Copy link
Member Author

Zac-HD commented Jun 22, 2019

Yeah... at least I have a clear target for my first stdlib contribution if I can find the time. Once it's fixed upstream, I'd be inclined to add it in the next major version of pytest even if we can't enable it on all versions of Python.

Or I might just bite the bullet and implement it on our OptionParser class. We'll see. Either way it's not the easy fix I was hoping for...

@nicoddemus
Copy link
Member

Yeah, thanks @Zac-HD anyway!

Should we close this then?

@Zac-HD
Copy link
Member Author

Zac-HD commented Jun 23, 2019

Yeah, I'll open a new one if I get a fix and backport working.

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.

None yet

2 participants