fix the rest of py/code tests on python 3

--HG--
branch : trunk
This commit is contained in:
Benjamin Peterson 2009-08-29 09:37:56 -05:00
parent 96ec12902d
commit 0f7a9e2da2
2 changed files with 12 additions and 5 deletions

View File

@ -74,3 +74,6 @@ class AssertionError(BuiltinAssertionError):
self.args = (self.msg,)
else:
self.msg = None
if sys.version_info > (3, 0):
AssertionError.__module__ = "builtins"

View File

@ -295,11 +295,15 @@ class TestFormattedExcinfo:
def test_repr_source_excinfo(self):
""" check if indentation is right """
pr = FormattedExcinfo()
excinfo = self.excinfo_from_exec("""
def f():
assert 0
f()
""")
py.code.patch_builtins()
try:
excinfo = self.excinfo_from_exec("""
def f():
assert 0
f()
""")
finally:
py.code.unpatch_builtins()
pr = FormattedExcinfo()
source = pr._getentrysource(excinfo.traceback[-1])
lines = pr.get_source(source, 1, excinfo)