Commit graph

22 commits

Author SHA1 Message Date
Anthony Sottile
e94fb10940 require python>=3.7 2022-08-05 19:51:08 -04:00
Anthony Sottile
50d69150c1 rework plugin loading 2021-12-31 15:09:54 -08:00
Anthony Sottile
97c3de41bd fix test name after exit -> exit_code refactor 2021-11-14 16:38:39 -08:00
Anthony Sottile
81a4110338 have application return exit code for easier testing 2021-11-14 16:29:18 -08:00
Anthony Sottile
af1668bf04 extend black formatting to tests as well 2021-04-18 09:23:48 -07:00
Anthony Sottile
358ae85120 automatic: pyupgrade --py36-plus 2021-03-30 17:37:13 -07:00
Kinya TERASAKA
cc037338df Fixes --exit-zero when empty --diff
fixes pycqa/flake8/merge_requests!137
2019-12-02 13:47:15 +09:00
Eric N. Vander Weele
1abe1d42c2 application: Rename prelim parsing method to 'parse_preliminary_options'
Positional arguments are not used nor parsed for pre-configuration
loading.  Thus, renaming the method and updating the docstrings
appropriately.
2019-11-03 01:34:38 +08:00
Eric N. Vander Weele
4151ae0e53 application: Ensure --version is unknown during preliminary parsing
Now that the preliminary parser is being used, we can remove needing to
prune out `--version` and copying the original `argv` list.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
b9c8c3e118 application: Ensure -h/--help is unknown during preliminary parsing
Now that the preliminary parser is being used, we can remove needing to
prune out `-h` and `--help` from the copied `args` list.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
2260f5362e application: Keep unknown options in the unknown argument list
Positional arguments aren't necessary for determining where to
load configuration anymore and is safe to keep both options and
arguments to be forwarded for later parsing after configuration is
loaded.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
7f46990f4b application: Change to argparse.ArgumentParser for preliminary parsing
Now that preliminary options are registered with the preliminary parser
on the `Application`, leverage that for parsing known options.

This important change removes the `Application.option_manager` from
being responsible for pre-configuration parsing and the workarounds
needed in the `Application.parse_preliminary_options_and_args()` to
account for the fact that `Application.option_manager` was aware of
*all* options, not just the options necessary for pre-configuration
loading.  A following commit will address removing these workarounds.
2019-10-25 17:07:43 -04:00
Eric N. Vander Weele
b54164f916 application: Remove preliminary argument parsing state
The preliminary options and arguments returned from
`.parse_preliminary_options_and_args()` are now all threaded through to
the appropriate methods during initialization.
2019-10-01 08:48:18 +02:00
Eric N. Vander Weele
6043e90855 application: Return namespace and args from preliminary arg parsing
This is the initial step towards removing state from the `Application`
object during argument parsing and handling.  The goal is to remove
`Application.prelim_opts` and `Application.prelim_args`.
2019-10-01 08:48:18 +02:00
Anthony Sottile
b66ebd7034 move from optparse to argparse 2019-08-17 20:09:45 -07:00
Charles Frye
e9b9ebb58e makes prelim_args test more explicit 2019-03-11 14:05:34 -07:00
Charles Frye
16ca17388a Fixes handling of empty lists by Application
`Application.parse_preliminary_options_and_args` was previously, against
expectations, treating empty lists passed as the `argv` argument the
same way it treated `None`s.

This has been addressed and the correct behavior tested for in a unit
test of the `Application` class.

See issue #518 for details.
2019-03-07 20:27:59 -08:00
Anthony Sottile
ff15ba0865 Replace setuptools with entrypoints 2018-11-05 11:08:37 -08:00
Carl Meyer
54a8a551b3 Fix finding of local config files. 2017-08-07 17:57:25 -07:00
Carl Meyer
ca3c4d2545 Simplify application tests; remove unneeded mocking 2017-08-07 13:56:54 -07:00
Ian Cordasco
c62de6acc3
Make formatting plugin logic easier to test
By splitting out the logic to retrieve and return the formatting class
for an application, we can test it more easily and increase our test
coverage of this critical logic.

Refs #320
2017-05-13 08:00:43 -05:00
Ian Cordasco
c81a403fef
Exit non-zero if something goes wrong during a run
If we handle an exception, or early exit, or really anything, we should
exit non-zero (and we used to). This was a minor oversight.

Closes #209
Closes #248
2016-11-12 13:43:49 -06:00