git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[StGit PATCH] Don't print unnecessary backtraces when testing

From
David Kågedal <davidk@lysator.liu.se>
Date
Aug 17, 2007, 11:36 UTC
Message-ID
<87sl6ipf3g.fsf@morpheus.local>

When stg fails, and handles it properly, no backtrace should be printed, even when running tests with -v. Getting a backtrace in the output signals some kind of bug, but in this case there is no bug. ---

I was running tests with -v and saw python backtraces, and assumed that there was a bug somewhere. But apparently this backtrace only appeared when running tests.

I think it's better if you only get backtraces when something actually went wrong. The test driver sets the debug level to -1, so I changed the check to check for positive instead.

 stgit/main.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/stgit/main.py b/stgit/main.py
index 294b703..2390110 100644
--- a/stgit/main.py
+++ b/stgit/main.py
@@ -286,7 +286,7 @@ def main():
             StackException, GitException, GitMergeException,
             EditorException), err:
         print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
-        if debug_level:
+        if debug_level > 0:
             raise
         else:
             sys.exit(2)
-- 
1.5.3.rc3.119.g1812


-- 
David Kågedal
Message 1 of 1 in “Don't print unnecessary backtraces when testing”
  1. Don't print unnecessary backtraces when testingDavid Kågedal, Aug 17, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.