Skip to content
Snippets Groups Projects
Commit aca4c1ac authored by Ostermayer, Markus's avatar Ostermayer, Markus
Browse files

added argument to choose if colored output gets used

parent 3656e8fa
No related branches found
No related tags found
1 merge request!9added argument to choose if colored output gets used
Pipeline #199708 waiting for manual action
......@@ -22,6 +22,20 @@ def main(argv: Sequence[str] | None = None) -> int:
help='Displays all available tests the tester could fined',
)
parser.add_argument(
'--no-use-colors',
dest='use_colors',
action='store_false',
help='Disable colorful output when running tests',
)
parser.add_argument(
'--use-colors',
dest='use_colors',
action='store_true',
help='Uses colorful output when running tests',
)
parser.add_argument(
'--run-tests',
dest='run_tests',
......@@ -83,6 +97,7 @@ def main(argv: Sequence[str] | None = None) -> int:
return_val = _run_tests(
tests_to_run,
args.build_path,
args.use_colors,
args.testreport,
)
......
......@@ -109,6 +109,7 @@ def execute_test(
testname: TestFile,
build_path: str,
code_path: str,
use_colors: bool,
testreport: bool = False,
) -> int:
......@@ -138,7 +139,7 @@ def execute_test(
with open(
f'{build_path}/{testname.filename_without_ending}.log',
) as logfile:
for logline in follow(logfile, use_color=True):
for logline in follow(logfile, use_color=use_colors):
if 'Assertion failed' in logline:
test_result = Result.failed
......@@ -150,6 +151,7 @@ def execute_test(
_print_testresult(
testname.filename_without_ending.ljust(30, '.'),
test_status=test_result,
use_colors=use_colors,
)
if test_result == Result.failed:
......@@ -161,6 +163,7 @@ def execute_test(
def _run_tests(
tests_to_run: list[TestFile],
build_path: str,
use_colors: bool,
testreport: bool,
) -> int:
......@@ -233,6 +236,7 @@ def _run_tests(
test,
build_path,
code_path,
use_colors,
)
ret_val |= exec_test_ret_val
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment