Improve test result logging
Handle Enum correctly. Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
This commit is contained in:
parent
00c9634579
commit
9895c56984
@ -17,6 +17,7 @@ from configparser import ConfigParser
|
|||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
from pytest import ExitCode
|
||||||
|
|
||||||
argparser = ArgumentParser()
|
argparser = ArgumentParser()
|
||||||
config = ConfigParser()
|
config = ConfigParser()
|
||||||
@ -163,8 +164,10 @@ def runtests(payload, hosts):
|
|||||||
if not os.path.isfile(sshfile):
|
if not os.path.isfile(sshfile):
|
||||||
vagrant_sshconfig(sshfile)
|
vagrant_sshconfig(sshfile)
|
||||||
testresult = pytest.main(['--verbose', '--hosts={}'.format(','.join(hosts)), '--ssh-config={}'.format(sshfile), payload])
|
testresult = pytest.main(['--verbose', '--hosts={}'.format(','.join(hosts)), '--ssh-config={}'.format(sshfile), payload])
|
||||||
log.debug('Test result is {}'.format(str(testresult)))
|
log.debug('Test result is {}'.format(str(testresult.value)))
|
||||||
if not testresult:
|
if testresult == ExitCode.OK:
|
||||||
|
log.debug('Test succeeded')
|
||||||
|
else:
|
||||||
log.warning('Tests failed')
|
log.warning('Tests failed')
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
Loading…
Reference in New Issue
Block a user