summaryrefslogtreecommitdiff
path: root/tests/test_context.py
Commit message (Collapse)AuthorAgeFilesLines
* shell completion prioritizes option values over new optionsPaul Spangler2022-03-281-0/+8
| | | | | | | Allow option values that start with an option prefix to complete rather than treating them like new options. Don't treat count options as needing a value to complete.
* add pass_meta_key decoratorDavid Lord2021-03-051-0/+23
|
* ParameterSource is an Enum subclassAlan Velasco2020-10-071-56/+41
| | | | Co-authored-by: David Lord <davidism@gmail.com>
* context.show_default defaults to parent contextJoongi Kim2020-08-131-0/+14
|
* add an ExitStack to the contextMatthias Urlichs2020-08-091-0/+18
| | | | | | This makes it possible to open a resource, make it available to callbacks and subcommands, then ensure the resource is cleaned up when the group ends and the context goes out of scope.
* apply pyupgrade --py36-plusDavid Lord2020-04-201-7/+6
|
* Merge branch '7.x'David Lord2020-03-081-45/+53
|\
| * manual cleanupDavid Lord2020-03-081-3/+3
| |
| * apply blackDavid Lord2020-03-061-34/+39
| |
* | simplify parameter source testsDavid Lord2020-02-221-22/+24
| |
* | Undefined name: import sys for lines 300 and 311Christian Clauss2020-02-221-0/+1
| |
* | Changing ParameterSource.validate unit test to take a descriptive bad value. ↵Joshua Storck2019-06-031-1/+1
| | | | | | | | Changing Context._sources_by_paramname to Context._source_by_paramname. Renaming ParameterSource.validate clz arg to cls and removing doc for that argument in the docstring
* | Changing documentation in ParameterSource to indicate 'parameter' instead of ↵Joshua Storck2019-06-021-1/+7
| | | | | | | | 'option'. Removed emphasis of the word source in Context.get_parameter_source. Changed ParameterSource.VALUE to a set instead of list. Fixed bugs in ParameterSource.validate and added unit test for it. Changed Context.get_parameter_source to return a KeyError when an invalid parameter name is specified.
* | Added documentation on how to use get_parameter_source. Added DEFAULT_MAP as ↵Joshua Storck2019-05-311-11/+22
| | | | | | | | a source and added unit tests for it.
* | Adding support to the context to distinguish the source of a command line ↵Joshua Storck2019-05-311-0/+42
|/ | | | parameter
* Simplify Exit ExceptionStephen Rosen2018-08-261-13/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | = Refactor BaseCommand to simplify Exit handling BaseCommand.main() will get the return value from `self.invoke` and pass it to `ctx.exit()`, so that commands which `return 1` will `ctx.exit(1)` This is not a behavioral change -- `ctx.exit()` already does this. Do not reraise Exit exceptions when invoked non-standalone. Instead, return their exit codes as the result of `BaseCommand.main`. So, a command which explicitly invokes `ctx.exit(0)` in its execution will effectively `return 0` instead of raising a specialized exception. = Make Exit its own RuntimeError subtype, don't pollute stdio on exit Exit exceptions should not be a subtype of ClickException with the output pretty-printing (`show()`) which happens when they are raised in non-standalone mode. That would make `ctx.exit(...)` needlessly pollute stderr. This would have downstream impact on everyone using context exit calls, and generally be a Bad Thing (tm). Instead, like Abort, Exit is a subclass of RuntimeError with very little "meat on its bones". It's an exception containing a single integer (exit code) which is then interpreted in that way in BaseCommand.main closes #533 closes #667
* add tests for the runner when the app uses context.exitJoe Jevnik2018-08-261-0/+2
|
* make context.exit raise a custom exceptionJoe Jevnik2018-08-261-1/+25
| | | | | | This exception is caught in Command.main where we turn this into either an exception or a system exit. This allows context.exit to work when standalone_mode=False.
* Add test for make_pass_decorator arg handlingStephen Rosen2018-08-111-0/+36
| | | | | This adds a simple test case which ensures that `make_pass_decorator` doesn't consume arguments if it's called out of order.
* Pop the context after closing and not before. This fixes #412Armin Ronacher2015-09-151-0/+19
|
* Fix bug which happens while using @click.pass_objPietro Albini2015-08-171-0/+16
| | | | | | | | | | | | Rebased version of #410 for bugfix release When a function is decorated with @click.pass_obj, it should receive the ctx.obj content as first argument. Instead, it actually receives the ctx.obj content *and* ctx itself. This is an undocumented behavior, and it was introduced in click 5.0 with commit 695ca34. This commit fixes the decorator in order to restore the documented, pre-5.0 behavior, so the decorated function will receive only ctx.obj.
* More defensive for scope depth managementArmin Ronacher2015-07-201-2/+4
|
* Added Context.scopeArmin Ronacher2015-07-201-0/+24
|
* Added Context.metaArmin Ronacher2015-07-191-0/+19
|
* Implement support for thread local context.Armin Ronacher2015-07-141-0/+13
| | | | | | This allows click users to access the context object from anywhere within the current thread. The access to this object is properly scoped as before.
* Added a test for multi command entering.Armin Ronacher2014-08-121-0/+19
|
* Added support for object ensuringArmin Ronacher2014-05-011-0/+93