From 2109743fe3eedb967e064e37d939a51ec335dff5 Mon Sep 17 00:00:00 2001 From: Pierrick HYMBERT Date: Fri, 23 Feb 2024 17:12:33 +0100 Subject: [PATCH] server: tests: print server logs only on github action --- examples/server/tests/features/environment.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/server/tests/features/environment.py b/examples/server/tests/features/environment.py index 05ede6463..eee7d7a17 100644 --- a/examples/server/tests/features/environment.py +++ b/examples/server/tests/features/environment.py @@ -17,11 +17,12 @@ def before_scenario(context, scenario): def after_scenario(context, scenario): if scenario.status == "failed": - print(f"\x1b[33;101mSCENARIO FAILED: {scenario.name} server logs:\x1b[0m\n\n") - if os.path.isfile('llama.log'): - with closing(open('llama.log', 'r')) as f: - for line in f: - print(line) + if 'GITHUB_ACTIONS' in os.environ: + print(f"\x1b[33;101mSCENARIO FAILED: {scenario.name} server logs:\x1b[0m\n\n") + if os.path.isfile('llama.log'): + with closing(open('llama.log', 'r')) as f: + for line in f: + print(line) if not pid_exists(context.server_process.pid): assert False, f"Server not running pid={context.server_process.pid} ..."