MCPcopy
hub / github.com/pallets/click / test_command_context_class

Function test_command_context_class

tests/test_custom_classes.py:4–17  ·  view source on GitHub ↗

A command with a custom ``context_class`` should produce a context using that type.

()

Source from the content-addressed store, hash-verified

2
3
4def test_command_context_class():
5 """A command with a custom ``context_class`` should produce a
6 context using that type.
7 """
8
9 class CustomContext(click.Context):
10 pass
11
12 class CustomCommand(click.Command):
13 context_class = CustomContext
14
15 command = CustomCommand("test")
16 context = command.make_context("test", [])
17 assert isinstance(context, CustomContext)
18
19
20def test_context_invoke_type(runner):

Callers

nothing calls this directly

Calls 2

make_contextMethod · 0.80
CustomCommandClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…