When I am writing tests using the new testing framework formerly known as scenario, I find myself adding a line like this:
with ctx(ctx.on.start(), state_in) as manager:
charm = cast(KafkaCharm, manager.charm) # <-- This line...
assert not charm.broker.healthy # <-- ...gives me autocomplete and type checker validation
In larger code bases, this boilerplate adds up to numerous lines.
With a few tweaks to Context and Manager, we can make them variadic types and get this nice user experience:
If that's something you are interested in, I can open a PR. Have a look at my branch on ops-scenario, and let me know what you think!
Hi,
When I am writing tests using the new testing framework formerly known as scenario, I find myself adding a line like this:
In larger code bases, this boilerplate adds up to numerous lines.
With a few tweaks to
Context
andManager
, we can make them variadic types and get this nice user experience:If that's something you are interested in, I can open a PR. Have a look at my branch on ops-scenario, and let me know what you think!