mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-29 16:44:29 +02:00
parent
8a9c6c7342
commit
42687a3616
@ -84,15 +84,15 @@ class TestSuite(object):
|
|||||||
|
|
||||||
def _remove_file(self, path):
|
def _remove_file(self, path):
|
||||||
command = self._config['commands']['clean'].format(path)
|
command = self._config['commands']['clean'].format(path)
|
||||||
subprocess.call(command, stdout=DEVNULL, stderr=DEVNULL, shell=True)
|
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||||
|
|
||||||
def _exec_command(self, command):
|
def _exec_command(self, command):
|
||||||
command = self._config['commands']['exec'].format(command)
|
command = self._config['commands']['exec'].format(command)
|
||||||
subprocess.call(command, stdout=DEVNULL, stderr=DEVNULL, shell=True)
|
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||||
|
|
||||||
def _copy_file(self, source, destination):
|
def _copy_file(self, source, destination):
|
||||||
command = self._config['commands']['copy'].format(source, destination)
|
command = self._config['commands']['copy'].format(source, destination)
|
||||||
subprocess.call(command, stdout=DEVNULL, stderr=DEVNULL, shell=True)
|
subprocess.call(command, stdout=DEVNULL, shell=True)
|
||||||
|
|
||||||
def _copy_test(self, path):
|
def _copy_test(self, path):
|
||||||
self._copy_file(path, os.path.join(self._config['settings']['test_root'],
|
self._copy_file(path, os.path.join(self._config['settings']['test_root'],
|
||||||
@ -117,6 +117,9 @@ def parse_commandline():
|
|||||||
parser = OptionParser(version='0.1')
|
parser = OptionParser(version='0.1')
|
||||||
parser.add_option('-C', '--config', default="run_tests.conf",
|
parser.add_option('-C', '--config', default="run_tests.conf",
|
||||||
help='The path to the config file to use [%default]')
|
help='The path to the config file to use [%default]')
|
||||||
|
parser.add_option('-O', '--output',
|
||||||
|
help='The file which to save the test results. '
|
||||||
|
'(By default this goes to stdout)')
|
||||||
return parser.parse_args()
|
return parser.parse_args()
|
||||||
|
|
||||||
|
|
||||||
@ -128,7 +131,14 @@ def main():
|
|||||||
suite.add_test(path)
|
suite.add_test(path)
|
||||||
|
|
||||||
suite.run()
|
suite.run()
|
||||||
print suite.get_report().encode('utf-8')
|
|
||||||
|
report = suite.get_report()
|
||||||
|
if options.output is None:
|
||||||
|
print report.encode('utf-8')
|
||||||
|
else:
|
||||||
|
with open(options.output, 'w') as f:
|
||||||
|
f.write(report.encode('utf-8'))
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user