From 6488be3e8294ddceea0028b208bdcda791dc0a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Piwowarski?= Date: Fri, 21 Oct 2022 16:09:36 +0200 Subject: [PATCH] Change class variables to instance variables TempestConf has a set of class variables that do not need to be class variables because there are no multiple instances of TempestConf class that could share the value. The reason why we need to move the class variables to instance variables is that some unit tests under certain conditions were failing because multiple unit tests were changing the TempestConf.priority_sectionkeys value. Change-Id: Ic6f51be112aa9f93904fcab289d78a7e06f20f62 --- config_tempest/tempest_conf.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/config_tempest/tempest_conf.py b/config_tempest/tempest_conf.py index 601e419f..594df4a5 100644 --- a/config_tempest/tempest_conf.py +++ b/config_tempest/tempest_conf.py @@ -23,18 +23,20 @@ import tempest.config class TempestConf(configparser.ConfigParser): - # causes the config parser to preserve case of the options - optionxform = str - - # set of pairs `(section, key)` which have a higher priority (are - # user-defined) and will usually not be overwritten by `set()` - priority_sectionkeys = set() CONF = tempest.config.TempestConfigPrivate(parse_conf=False) def __init__(self, write_credentials=True, **kwargs): + # causes the config parser to preserve case of the options + self.optionxform = str + + # set of pairs `(section, key)` which have a higher priority (are + # user-defined) and will usually not be overwritten by + # `TempestConf.set()` + self.priority_sectionkeys = set() + self.write_credentials = write_credentials - configparser.ConfigParser.__init__(self, **kwargs) + super().__init__(self, **kwargs) def get_bool_value(self, value): """Returns boolean value of the string value given.