Timestamp log files

This commit is contained in:
Pedro Algarvio 2019-06-08 18:19:01 +01:00
parent 738d5765f9
commit eea27dc56b
No known key found for this signature in database
GPG key ID: BB36BF6584A298FF

View file

@ -15,6 +15,7 @@ import json
import pprint
import shutil
import tempfile
import datetime
if __name__ == '__main__':
sys.stderr.write('Do not execute this file directly. Use nox instead, it will know how to handle this file\n')
@ -36,7 +37,6 @@ REPO_ROOT = os.path.abspath(os.path.dirname(__file__))
SITECUSTOMIZE_DIR = os.path.join(REPO_ROOT, 'tests', 'support', 'coverage')
IS_DARWIN = sys.platform.lower().startswith('darwin')
IS_WINDOWS = sys.platform.lower().startswith('win')
# Python versions to run against
_PYTHON_VERSIONS = ('2', '2.7', '3', '3.4', '3.5', '3.6', '3.7')
@ -49,6 +49,11 @@ nox.options.error_on_missing_interpreters = False
# Change current directory to REPO_ROOT
os.chdir(REPO_ROOT)
RUNTESTS_LOGFILE = os.path.join(
'artifacts', 'logs',
'runtests-{}.log'.format(datetime.datetime.now().strftime('%Y%m%d%H%M%S.%f'))
)
def _create_ci_directories():
for dirname in ('logs', 'coverage', 'xml-unittests-output'):
@ -469,9 +474,7 @@ def runtests_parametrized(session, coverage, transport, crypto):
session.install(*install_command, silent=PIP_INSTALL_SILENT)
cmd_args = [
'--tests-logfile={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--tests-logfile={}'.format(RUNTESTS_LOGFILE),
'--transport={}'.format(transport)
] + session.posargs
_runtests(session, coverage, cmd_args)
@ -615,9 +618,7 @@ def runtests_cloud(session, coverage):
session.install('--progress-bar=off', '-r', cloud_requirements, silent=PIP_INSTALL_SILENT)
cmd_args = [
'--tests-logfile={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--tests-logfile={}'.format(RUNTESTS_LOGFILE),
'--cloud-provider-tests'
] + session.posargs
_runtests(session, coverage, cmd_args)
@ -632,9 +633,7 @@ def runtests_tornado(session, coverage):
session.install('--progress-bar=off', 'pyzmq==17.0.0', silent=PIP_INSTALL_SILENT)
cmd_args = [
'--tests-logfile={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--tests-logfile={}'.format(RUNTESTS_LOGFILE)
] + session.posargs
_runtests(session, coverage, cmd_args)
@ -665,9 +664,8 @@ def pytest_parametrized(session, coverage, transport, crypto):
cmd_args = [
'--rootdir', REPO_ROOT,
'--log-file={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--log-file={}'.format(RUNTESTS_LOGFILE),
'--log-file-level=debug',
'--no-print-logs',
'-ra',
'-s',
@ -814,9 +812,8 @@ def pytest_cloud(session, coverage):
cmd_args = [
'--rootdir', REPO_ROOT,
'--log-file={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--log-file={}'.format(RUNTESTS_LOGFILE),
'--log-file-level=debug',
'--no-print-logs',
'-ra',
'-s',
@ -835,9 +832,8 @@ def pytest_tornado(session, coverage):
cmd_args = [
'--rootdir', REPO_ROOT,
'--log-file={}'.format(
os.path.join('artifacts', 'logs', 'runtests.log')
),
'--log-file={}'.format(RUNTESTS_LOGFILE),
'--log-file-level=debug',
'--no-print-logs',
'-ra',
'-s',