Commits

Christian Boos committed 58d33f5

Wiki tests: keep our custom test failure output even with Python 2.7

Python 2.7 introduces a `safe_repr(obj, short)` utility which may
truncate the output. This is all nice, but it messes up the custom
diff we produce in `WikiTestCase`, so we force it to ignore the
`short` flag.

  • Participants
  • Parent commits 4073db1
  • Branches trunk

Comments (0)

Files changed (1)

trac/wiki/tests/formatter.py

 import os
 import re
 import unittest
+
+# Python 2.7 `assertMultiLineEqual` calls `safe_repr(..., short=True)`
+# which breaks our custom failure display in WikiTestCase.
+
+try:
+    from unittest.util import safe_repr
+    unittest.case.safe_repr = lambda obj, short: safe_repr(obj, False)
+except ImportError:
+    pass
+
+
 from datetime import datetime
 
 try: