Skip to content
This repository was archived by the owner on Dec 27, 2023. It is now read-only.

Commit fab0347

Browse files
committed
Print logs folder location on session_error
Signed-off-by: Andrea Cervesato <[email protected]>
1 parent e842f3c commit fab0347

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ltp/ui.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
.. moduleauthor:: Andrea Cervesato <[email protected]>
77
"""
8+
import os
89
import platform
910
import ltp
1011
from ltp.data import Test
@@ -32,6 +33,7 @@ class ConsoleUserInterface:
3233
def __init__(self, no_colors: bool = False) -> None:
3334
self._no_colors = no_colors
3435
self._line = ""
36+
self._tmpdir = ""
3537

3638
ltp.events.register("session_started", self.session_started)
3739
ltp.events.register("session_stopped", self.session_stopped)
@@ -115,6 +117,7 @@ def session_started(self, tmpdir: str) -> None:
115117
message += f"\n\tTemporary directory: {tmpdir}\n"
116118

117119
self._print(message)
120+
self._tmpdir = tmpdir
118121

119122
def session_stopped(self) -> None:
120123
self._print("Session stopped")
@@ -174,7 +177,12 @@ def suite_timeout(self, suite: Suite, timeout: float) -> None:
174177
color=self.RED)
175178

176179
def session_error(self, error: str) -> None:
180+
debug_log = os.path.join(self._tmpdir, "debug.log")
181+
177182
self._print(f"Error: {error}", color=self.RED)
183+
self._print(
184+
f"Debug information can be found here: {debug_log}",
185+
color=self.RED)
178186

179187
def internal_error(self, exc: BaseException, func_name: str) -> None:
180188
self._print(

0 commit comments

Comments
 (0)