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,) self.args = (self.msg,)
else: else:
self.msg = None 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): def test_repr_source_excinfo(self):
""" check if indentation is right """ """ check if indentation is right """
pr = FormattedExcinfo() pr = FormattedExcinfo()
excinfo = self.excinfo_from_exec(""" py.code.patch_builtins()
def f(): try:
assert 0 excinfo = self.excinfo_from_exec("""
f() def f():
""") assert 0
f()
""")
finally:
py.code.unpatch_builtins()
pr = FormattedExcinfo() pr = FormattedExcinfo()
source = pr._getentrysource(excinfo.traceback[-1]) source = pr._getentrysource(excinfo.traceback[-1])
lines = pr.get_source(source, 1, excinfo) lines = pr.get_source(source, 1, excinfo)