X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=tests%2Fbase.py;h=e1ec45238228e284ba41294b6f08161d89cae0f9;hb=40933126953cd398c1f9783513ec706a14f78665;hp=8ea51092d5129c85bb2375f87a56c8f92148cd31;hpb=d23810d57aa7f0fa67070781645f4898e20db0ed;p=osm%2FN2VC.git diff --git a/tests/base.py b/tests/base.py index 8ea5109..e1ec452 100644 --- a/tests/base.py +++ b/tests/base.py @@ -44,6 +44,9 @@ class CleanModel(): model_name = 'model-{}'.format(uuid.uuid4()) self.model = await self.controller.add_model(model_name) + # save the model UUID in case test closes model + self.model_uuid = self.model.info.uuid + # Ensure that we connect to the new model by default. This also # prevents failures if test was started with no current model. self._patch_cm = mock.patch.object(JujuData, 'current_model', @@ -55,7 +58,7 @@ class CleanModel(): async def __aexit__(self, exc_type, exc, tb): self._patch_cm.stop() await self.model.disconnect() - await self.controller.destroy_model(self.model.info.uuid) + await self.controller.destroy_model(self.model_uuid) await self.controller.disconnect()