Commit 34d7fb60 authored by Jérome Perrin's avatar Jérome Perrin

Repair tests and other fixes

revert accidentally pushed commit and fix test failures introduced by !192

See merge request !216
parents 7d0f70aa 11afbd15
Pipeline #9329 passed with stage
......@@ -49,15 +49,16 @@ import platform
import re
def _debianize(os):
def _debianize(os_):
"""
keep only the major release number in case of debian, otherwise
minor releases would be seen as not compatible to each other.
"""
distname, version, id_ = os
distname = distname.lower()
if distname == 'debian' and '.' in version:
distname, version, id_ = os_
distname_lower = distname.lower()
if distname_lower == 'debian' and '.' in version:
version = version.split('.')[0]
distname = distname_lower
return distname, version, id_
......@@ -65,9 +66,9 @@ def os_matches(os1, os2):
return _debianize(os1) == _debianize(os2)
_distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
_release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
_codename_file_re = re.compile("(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I)
_distributor_id_file_re = re.compile(r"(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
_release_file_re = re.compile(r"(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
_codename_file_re = re.compile(r"(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I)
def patched_linux_distribution(distname='', version='', id='',
......@@ -90,7 +91,7 @@ def patched_linux_distribution(distname='', version='', id='',
if _u_distname and _u_version:
return (_u_distname, _u_version, _u_id)
except (EnvironmentError, UnboundLocalError):
pass
pass
return platform.linux_distribution(distname, version, id, supported_dists, full_distribution_name)
......
......@@ -152,14 +152,7 @@ def makeModuleSetUpAndTestCaseClass(
if debug:
unittest.installHandler()
logging.basicConfig(
level=logging.DEBUG,
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
filename=os.path.join(slap._base_directory, 'var', 'log', 'test.log'))
logger = logging.getLogger()
console_handler = logging.StreamHandler()
console_handler.setLevel(
logging.DEBUG if (verbose or debug) else logging.WARNING)
logger.addHandler(console_handler)
level=logging.DEBUG if (verbose or debug) else logging.WARNING)
installSoftwareUrlList(cls, [software_url], debug=debug)
return setUpModule, SlapOSInstanceTestCase_
......@@ -369,9 +362,7 @@ def installSoftwareUrlList(cls, software_url_list, max_retry=2, debug=False):
cls.slap.waitForSoftware(max_retry=max_retry, debug=debug)
_storeSoftwareSnapshot('setupModule')
for software_url in software_url_list:
cls.logger.debug("Checking software %s", software_url)
checkSoftware(cls.slap, software_url)
cls.logger.debug("Done checking software %s", software_url)
except BaseException as e:
if not debug:
cls.logger.exception("Error building software, removing")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment