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

fix: prevent argparse from eating up abbreviated args that should be passed to the runner #29

Merged
merged 3 commits into from
Mar 25, 2024

Conversation

radoshi
Copy link
Contributor

@radoshi radoshi commented Mar 21, 2024

argparse optimistically shortens arguments when things are unambigous.

This means that --ignore /some/pattern will get matched to --ignore-patterns /some/pattern. This is not the intended behavior when trying to pass --ignore to pytest.

This PR:

  • Fixes this problem by forcing the argument parser to be strict.
  • Fixes the test_parse_arguments unit test, which wasn't really testing anything.
  • Adds a unit test to ensure new behavor.

All tests pass.

@radoshi
Copy link
Contributor Author

radoshi commented Mar 21, 2024

Please note - due to some strange conflict, I wasn't able to run ruff. If the formatting is off, I'd appreciate a push to the branch with the correct formatting (or you can take the PR and fix the formatting).

@olzhasar
Copy link
Owner

Hi @radoshi,

Thank you for your contribution!

The PR looks good to me, but it needs to be formatted to merge.
What error are you getting when trying to format the code?

Could you try to run ruff like the following:

ruff check --fix .

@radoshi
Copy link
Contributor Author

radoshi commented Mar 24, 2024 via email

@radoshi
Copy link
Contributor Author

radoshi commented Mar 24, 2024

okay, sent you #31 to cover the ruff version updates.

@olzhasar olzhasar merged commit dc12a5a into olzhasar:master Mar 25, 2024
6 checks passed
olzhasar added a commit that referenced this pull request Apr 2, 2024
* build: update deps, remove isort and black.

* fix: prevent argparse from eating up abbreviated args that should be passed to the runner (#29)

* fix: prevent argparse from eating up abbreviated args that should be passed to the runner

* build: fixing with `ruff check .`

* build: formatting update.

* Add python 3.12 to the tox.ini

* Bump version 0.4.1 -> 0.4.2

* Update CHANGELOG

* Add python 3.12 to github test workflow

* Update LICENSE

* build: update deps, remove isort and black.

* Update pre-commit hooks. Instruct ruff to sort

---------

Co-authored-by: olzhasar <[email protected]>
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.

2 participants