Skip to content

Commit

Permalink
atest: Don't generate log and report if all tests pass.
Browse files Browse the repository at this point in the history
  • Loading branch information
pekkaklarck committed Jul 28, 2023
1 parent d7fe620 commit 550ed6d
Showing 1 changed file with 17 additions and 5 deletions.
22 changes: 17 additions & 5 deletions atest/run.py
Expand Up @@ -48,13 +48,15 @@
ARGUMENTS = '''
--doc Robot Framework acceptance tests
--metadata interpreter:{interpreter}
--variablefile {variable_file};{interpreter.path};{interpreter.name};{interpreter.version}
--variable-file {variable_file};{interpreter.path};{interpreter.name};{interpreter.version}
--pythonpath {pythonpath}
--outputdir {outputdir}
--output-dir {outputdir}
--splitlog
--console dotted
--consolewidth 100
--SuiteStatLevel 3
--console-width 100
--suite-stat-Level 3
--log NONE
--report NONE
'''.strip()


Expand All @@ -65,7 +67,8 @@ def atests(interpreter, arguments, schema_validation=False):
sys.exit(err)
outputdir, tempdir = _get_directories(interpreter)
arguments = list(_get_arguments(interpreter, outputdir)) + list(arguments)
return _run(arguments, tempdir, interpreter, schema_validation)
rc = _run(arguments, tempdir, interpreter, schema_validation)
_rebot(rc, outputdir)


def _get_directories(interpreter):
Expand Down Expand Up @@ -107,6 +110,15 @@ def _run(args, tempdir, interpreter, schema_validation):
return subprocess.call(command, env=environ)


def _rebot(rc, outputdir):
if rc == 0:
print('All tests passed, not generating log and report.')
elif rc < 251:
command = [sys.executable, str(CURDIR.parent / 'src/robot/rebot.py'),
'--output-dir', str(outputdir), str(outputdir / 'output.xml')]
subprocess.call(command)


if __name__ == '__main__':
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('-I', '--interpreter', default=sys.executable)
Expand Down

0 comments on commit 550ed6d

Please sign in to comment.