示例#1
0
 def __init__(self, *args, **dargs):
     """
     Initialize new subtest, passes all arguments through to parent class
     """
     super(Subtest, self).__init__(*args, **dargs)
     # log indentation level not easy to get at, so use opaque implementation
     _si = job.status_indenter(self.job)
     _sl = base_job.status_logger(self.job, _si)
     self._re = _sl.render_entry  # will return string w/ proper indentation
     # So tests don't need to set this up every time
     config_parser = config.Config()
     self.config = config_parser.get(self.config_section)
     if self.config is None:
         logging.warning("No configuration section found '%s'",
                         self.config_section)
         self.config = config_parser['DEFAULTS']
         # Mark this to not be checked, no config, no version info.
         self.config['config_version'] = version.NOVERSIONCHECK
         self.version = 0
     else:
         # Version number used by one-time setup() test.test method
         self.version = version.str2int(self.config['config_version'])
     # Fail test if configuration being used doesn't match dockertest API
     version.check_version(self.config)
     # Log original key/values before subtest could modify them
     self.write_test_keyval(self.config)
     # Optionally setup different iterations if option exists
     self.iterations = self.config.get('iterations', self.iterations)
     # subclasses can do whatever they like with this
     self.stuff = {}
示例#2
0
 def _init_config():  # private, no docstring pylint: disable=C0111
     # So tests don't need to set this up every time
     config_parser = config.Config()
     self.config = config_parser.get(self.config_section)
     if self.config is None:
         # Try generating config_section name
         config_section = _make_cfgsect()  # not exist: need class-attr
         # instance isn't setup yet, logging doesn't work :(
         if config_section in config_parser:
             self.config_section = config_section
             self.config = config_parser.get(self.config_section)
         else:  # auto-generate failed
             self.config = config_parser['DEFAULTS']
             # Mark this to not be checked, no config, no version info.
             self.config['config_version'] = version.NOVERSIONCHECK
             self.version = 0
             self.config_section = config_section
             # just in case anything looks
             self.config['config_section'] = config_section
     else:
         # Version number used by one-time setup() test.test method
         self.version = version.str2int(self.config['config_version'])
示例#3
0
 def _init_config():  # private, no docstring pylint: disable=C0111
     # So tests don't need to set this up every time
     config_parser = config.Config()
     self.config = config_parser.get(self.config_section)
     if self.config is None:
         # Try generating config_section name
         config_section = _make_cfgsect()  # not exist: need class-attr
         # instance isn't setup yet, logging doesn't work :(
         if config_section in config_parser:
             self.config_section = config_section
             self.config = config_parser.get(self.config_section)
         else:  # auto-generate failed
             self.config = config_parser['DEFAULTS']
             # Mark this to not be checked, no config, no version info.
             self.config['config_version'] = version.NOVERSIONCHECK
             self.version = 0
             self.config_section = config_section
             # just in case anything looks
             self.config['config_section'] = config_section
     if self.version is None:
         # Version number used by one-time setup() test.test method
         self.version = version.str2int(self.config['config_version'])