server_environment: Improve tests.common to allow redefinition of serv_config application
This commit is contained in:
parent
b867310279
commit
f260cca2b5
|
|
@ -44,13 +44,13 @@ class ServerEnvironmentCase(common.SavepointCase):
|
|||
yield
|
||||
|
||||
@contextmanager
|
||||
def load_config(self, public=None, secret=None):
|
||||
original_serv_config = server_env_mixin.serv_config
|
||||
def load_config(self, public=None, secret=None, serv_config_class=server_env_mixin):
|
||||
original_serv_config = serv_config_class.serv_config
|
||||
try:
|
||||
with self.set_config_dir(None), self.set_env_variables(public, secret):
|
||||
parser = server_env._load_config()
|
||||
server_env_mixin.serv_config = parser
|
||||
serv_config_class.serv_config = parser
|
||||
yield
|
||||
|
||||
finally:
|
||||
server_env_mixin.serv_config = original_serv_config
|
||||
serv_config_class.serv_config = original_serv_config
|
||||
|
|
|
|||
Loading…
Reference in New Issue