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
...@@ -49,15 +49,16 @@ import platform ...@@ -49,15 +49,16 @@ import platform
import re import re
def _debianize(os): def _debianize(os_):
""" """
keep only the major release number in case of debian, otherwise keep only the major release number in case of debian, otherwise
minor releases would be seen as not compatible to each other. minor releases would be seen as not compatible to each other.
""" """
distname, version, id_ = os distname, version, id_ = os_
distname = distname.lower() distname_lower = distname.lower()
if distname == 'debian' and '.' in version: if distname_lower == 'debian' and '.' in version:
version = version.split('.')[0] version = version.split('.')[0]
distname = distname_lower
return distname, version, id_ return distname, version, id_
...@@ -65,9 +66,9 @@ def os_matches(os1, os2): ...@@ -65,9 +66,9 @@ def os_matches(os1, os2):
return _debianize(os1) == _debianize(os2) return _debianize(os1) == _debianize(os2)
_distributor_id_file_re = re.compile("(?:DISTRIB_ID\s*=)\s*(.*)", re.I) _distributor_id_file_re = re.compile(r"(?:DISTRIB_ID\s*=)\s*(.*)", re.I)
_release_file_re = re.compile("(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I) _release_file_re = re.compile(r"(?:DISTRIB_RELEASE\s*=)\s*(.*)", re.I)
_codename_file_re = re.compile("(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I) _codename_file_re = re.compile(r"(?:DISTRIB_CODENAME\s*=)\s*(.*)", re.I)
def patched_linux_distribution(distname='', version='', id='', def patched_linux_distribution(distname='', version='', id='',
...@@ -90,7 +91,7 @@ def patched_linux_distribution(distname='', version='', id='', ...@@ -90,7 +91,7 @@ def patched_linux_distribution(distname='', version='', id='',
if _u_distname and _u_version: if _u_distname and _u_version:
return (_u_distname, _u_version, _u_id) return (_u_distname, _u_version, _u_id)
except (EnvironmentError, UnboundLocalError): except (EnvironmentError, UnboundLocalError):
pass pass
return platform.linux_distribution(distname, version, id, supported_dists, full_distribution_name) return platform.linux_distribution(distname, version, id, supported_dists, full_distribution_name)
......
...@@ -152,14 +152,7 @@ def makeModuleSetUpAndTestCaseClass( ...@@ -152,14 +152,7 @@ def makeModuleSetUpAndTestCaseClass(
if debug: if debug:
unittest.installHandler() unittest.installHandler()
logging.basicConfig( logging.basicConfig(
level=logging.DEBUG, level=logging.DEBUG if (verbose or debug) else logging.WARNING)
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)
installSoftwareUrlList(cls, [software_url], debug=debug) installSoftwareUrlList(cls, [software_url], debug=debug)
return setUpModule, SlapOSInstanceTestCase_ return setUpModule, SlapOSInstanceTestCase_
...@@ -369,9 +362,7 @@ def installSoftwareUrlList(cls, software_url_list, max_retry=2, debug=False): ...@@ -369,9 +362,7 @@ def installSoftwareUrlList(cls, software_url_list, max_retry=2, debug=False):
cls.slap.waitForSoftware(max_retry=max_retry, debug=debug) cls.slap.waitForSoftware(max_retry=max_retry, debug=debug)
_storeSoftwareSnapshot('setupModule') _storeSoftwareSnapshot('setupModule')
for software_url in software_url_list: for software_url in software_url_list:
cls.logger.debug("Checking software %s", software_url)
checkSoftware(cls.slap, software_url) checkSoftware(cls.slap, software_url)
cls.logger.debug("Done checking software %s", software_url)
except BaseException as e: except BaseException as e:
if not debug: if not debug:
cls.logger.exception("Error building software, removing") 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