()
| 520 | |
| 521 | |
| 522 | def test_with_resource(): |
| 523 | @contextmanager |
| 524 | def manager(): |
| 525 | val = [1] |
| 526 | yield val |
| 527 | val[0] = 0 |
| 528 | |
| 529 | ctx = click.Context(click.Command("test")) |
| 530 | |
| 531 | with ctx.scope(): |
| 532 | rv = ctx.with_resource(manager()) |
| 533 | assert rv[0] == 1 |
| 534 | |
| 535 | assert rv == [0] |
| 536 | |
| 537 | |
| 538 | def test_with_resource_exception() -> None: |
nothing calls this directly
no test coverage detected