Simplify BaseResourceFixture.setup_client

This avoids the following error on some branches:
TypeError: Subscripted generics cannot be used with class and instance checks

The method keystone.keystone_client already checks whether the keystone
client was created before or not.

Change-Id: Ic5f8a9908f07be894b41017b121e03068348c8b4
This commit is contained in:
Eduardo Olivares 2024-03-20 13:22:54 +01:00
parent f650d7adcb
commit 7228988b67

View File

@ -59,15 +59,10 @@ class BaseResourceFixture(tobiko.SharedFixture):
return self.setup_client().session
def setup_client(self) -> keystone.KeystoneClient:
client = self.client
# NOTE(slaweq): it seems that due to bug
# https://github.com/python/mypy/issues/11673
# in mypy this line is causing arg-type error so lets
# ignore it for now
if not isinstance(
client, keystone.KeystoneClient): # type: ignore[arg-type]
self.client = client = keystone.keystone_client(self.client)
return client
# returns self.client itself, if the keystone client was already
# created; else, creates a new keystone client and returns it.
self.client = keystone.keystone_client(self.client)
return self.client
def ensure_quota_limits(self):
"""Ensures quota limits before creating a new stack