def test_fromFile_withError(self):
- # If the diffstat isn't real, we want to record an oops but continue.
+ # If the diff is formatted such that generating the diffstat fails, we
+ # want to record an oops but continue. last_oops_id = errorlog.globalErrorUtility.lastid
diff_bytes = "not a real diff"
diff = Diff.fromFile(StringIO(diff_bytes), len(diff_bytes))
Sounds good. Thanks.
=== modified file 'lib/lp/ code/model/ diff.py' code/model/ diff.py 2009-09-25 02:54:56 +0000 code/model/ diff.py 2009-09-25 03:40:24 +0000
diffstat = cls.generateDif fstat(diff_ content_ bytes) IErrorReporting Utility) .raising( info) IErrorReporting Utility) .raising( sys.exc_ info())
diffstat = {} text=diff_ text, diff_lines_ count=diff_ lines_count,
--- lib/lp/
+++ lib/lp/
@@ -161,8 +161,7 @@
try:
except Exception:
- info = sys.exc_info()
- getUtility(
+ getUtility(
# Set the diffstat to be empty.
return cls(diff_
=== modified file 'lib/lp/ code/model/ tests/test_ diff.py' code/model/ tests/test_ diff.py 2009-09-25 02:54:56 +0000 code/model/ tests/test_ diff.py 2009-09-25 03:41:21 +0000
diff. diffstat)
--- lib/lp/
+++ lib/lp/
@@ -151,7 +151,8 @@
def test_fromFile_ withError( self):
last_ oops_id = errorlog. globalErrorUtil ity.lastid StringIO( diff_bytes) , len(diff_bytes))
- # If the diffstat isn't real, we want to record an oops but continue.
+ # If the diff is formatted such that generating the diffstat fails, we
+ # want to record an oops but continue.
diff_bytes = "not a real diff"
diff = Diff.fromFile(