Open
Description
It seems that most charms' integration tests assume that ops_test.model
is truthy (6592 call sites):
async def setup_env(ops_test: OpsTest):
await ops_test.model.set_config(...)
And a few ensure that it's truthy (46 call sites):
async def test_integrate(ops_test: OpsTest):
assert ops_test.model is not None
await asyncio.gather(
ops_test.model.integrate("mimir:s3", "s3"),
...
)
I didn't find a single test that's conditional on the model being or not being there. We're tracking ~160 charming repos in https://github.com/tonyandrewmeyer/charm-analysis
Currently, it's typed so:
@property
def model(self) -> Optional[Model]:
"""Represents the current model."""
current_state = self.current_alias and self._models.get(self.current_alias)
return current_state.model if current_state else None
I'm proposing to type it as Model
and raise if the model is not available.
Metadata
Assignees
Labels
No labels
Activity