[Checkins] SVN: zope.exceptions/trunk/ Fixed tests to work under Python 2.7. In 2.7 "exec" works like the normal Python compiler and automatically assumes a newline at the end of a file. Before Python 2.7 exec required an explicit newline. By using an explicit newline the exception is the same under all versions.
Hanno Schlichting
hannosch at hannosch.eu
Tue Jul 6 13:25:23 EDT 2010
Log message for revision 114248:
Fixed tests to work under Python 2.7. In 2.7 "exec" works like the normal Python compiler and automatically assumes a newline at the end of a file. Before Python 2.7 exec required an explicit newline. By using an explicit newline the exception is the same under all versions.
Changed:
U zope.exceptions/trunk/CHANGES.txt
U zope.exceptions/trunk/src/zope/exceptions/tests/test_exceptionformatter.py
-=-
Modified: zope.exceptions/trunk/CHANGES.txt
===================================================================
--- zope.exceptions/trunk/CHANGES.txt 2010-07-06 17:13:55 UTC (rev 114247)
+++ zope.exceptions/trunk/CHANGES.txt 2010-07-06 17:25:23 UTC (rev 114248)
@@ -5,6 +5,8 @@
3.6.1 (unreleased)
------------------
+- Fixed tests to work under Python 2.7.
+
- PEP8 cleanup and removed obsolete build infrastructure files.
Modified: zope.exceptions/trunk/src/zope/exceptions/tests/test_exceptionformatter.py
===================================================================
--- zope.exceptions/trunk/src/zope/exceptions/tests/test_exceptionformatter.py 2010-07-06 17:13:55 UTC (rev 114247)
+++ zope.exceptions/trunk/src/zope/exceptions/tests/test_exceptionformatter.py 2010-07-06 17:25:23 UTC (rev 114248)
@@ -144,20 +144,13 @@
def testMultilineException(self):
try:
- exec 'syntax error'
+ exec 'syntax error\n'
except Exception:
s = tb()
- # Traceback (most recent call last):
- # Module zope.exceptions.tests.test_exceptionformatter, line ??, in testMultilineException
- # exec \'syntax error\'
- # File "<string>", line 1
- # syntax error
- # ^
- # SyntaxError: unexpected EOF while parsing
self.assertEquals(s.splitlines()[-3:],
[' syntax error',
' ^',
- 'SyntaxError: unexpected EOF while parsing'])
+ 'SyntaxError: invalid syntax'])
def test_suite():
More information about the checkins
mailing list