Improve test result logging

Handle Enum correctly.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
Georg Pfuetzenreuter 2023-05-21 11:23:10 +02:00
parent 00c9634579
commit 9895c56984
Signed by: Georg
GPG Key ID: 1ED2F138E7E6FF57

View File

@ -17,6 +17,7 @@ from configparser import ConfigParser
import logging
import os
import sys
from pytest import ExitCode
argparser = ArgumentParser()
config = ConfigParser()
@ -163,8 +164,10 @@ def runtests(payload, hosts):
if not os.path.isfile(sshfile):
vagrant_sshconfig(sshfile)
testresult = pytest.main(['--verbose', '--hosts={}'.format(','.join(hosts)), '--ssh-config={}'.format(sshfile), payload])
log.debug('Test result is {}'.format(str(testresult)))
if not testresult:
log.debug('Test result is {}'.format(str(testresult.value)))
if testresult == ExitCode.OK:
log.debug('Test succeeded')
else:
log.warning('Tests failed')
return False
return True