[PATCH] enable colorful traceback conditionally

4 views
Skip to first unread message

Julien Jehannet

unread,
Oct 11, 2010, 11:55:32 AM10/11/10
to windmi...@googlegroups.com
Hello,

Here is a patch about the colorful traceback display.

My use case is to redisplay the provided traceback in my continuous integration
system but the trace is already mangled by ANSI characters.
IMO, we should only provide colorful traceback if we're sure that the current
stderr is a valid TTY (which mimicks the ls --color behaviour that way)


Cordially,

Julien Jehannet (1):
Do not enable colorful traceback if stderr is not a tty

windmill/dep/_functest/frame.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

Julien Jehannet

unread,
Oct 11, 2010, 11:55:33 AM10/11/10
to windmi...@googlegroups.com
This is especially useful when Windmill is used in automation
environment and you want to obtain default traceback trace.
---

windmill/dep/_functest/frame.py | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/windmill/dep/_functest/frame.py b/windmill/dep/_functest/frame.py
index eafc886..9904c73 100755
--- a/windmill/dep/_functest/frame.py
+++ b/windmill/dep/_functest/frame.py
@@ -152,7 +152,7 @@ def run_test_function(test, args=[]):
return True
except AssertionError, inst:
test.endtime = datetime.now()
- if pygments:
+ if pygments and sys.stderr.isatty():
formatter.highlight_traceback(sys.exc_info())
else:
tb = traceback.format_exception(*sys.exc_info())
@@ -169,7 +169,7 @@ def run_test_function(test, args=[]):
return False
except Exception, inst:
test.endtime = datetime.now()
- if pygments:
+ if pygments and sys.stderr.isatty():
formatter.highlight_traceback(sys.exc_info())
else:
tb = traceback.format_exception(*sys.exc_info())
--
1.5.6.5

Adam Christian

unread,
Oct 11, 2010, 12:26:35 PM10/11/10
to windmi...@googlegroups.com
Julien,

These look like great patches -- is there any chance I can get you to submit them as pull requests on github? makes it easy to track all the contributions.

Adam


--
You received this message because you are subscribed to the Google Groups "Windmill Developers" group.
To post to this group, send email to windmi...@googlegroups.com.
To unsubscribe from this group, send email to windmill-dev...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/windmill-dev?hl=en.


Reply all
Reply to author
Forward
0 new messages