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

Function test_context_pushing

tests/test_context.py:294–317  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

292
293
294def test_context_pushing():
295 rv = []
296
297 @click.command()
298 def cli():
299 pass
300
301 ctx = click.Context(cli)
302
303 @ctx.call_on_close
304 def test_callback():
305 rv.append(42)
306
307 with ctx.scope(cleanup=False):
308 # Internal
309 assert ctx._depth == 2
310
311 assert rv == []
312
313 with ctx.scope():
314 # Internal
315 assert ctx._depth == 1
316
317 assert rv == [42]
318
319
320def test_pass_obj(runner):

Callers

nothing calls this directly

Calls 1

scopeMethod · 0.95

Tested by

no test coverage detected