()
| 292 | |
| 293 | |
| 294 | def 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 | |
| 320 | def test_pass_obj(runner): |