fix a import strange loop that affects pypy test appsupport on python2.5

This commit is contained in:
Ronny Pfannschmidt 2012-04-13 12:41:02 +02:00
parent b92176024c
commit d02eaa8881
4 changed files with 18 additions and 4 deletions

View File

@ -1,8 +1,7 @@
import py
import sys, inspect
from compiler import parse, ast, pycodegen
from _pytest.assertion.util import format_explanation
from _pytest.assertion.reinterpret import BuiltinAssertionError
from _pytest.assertion.util import format_explanation, BuiltinAssertionError
passthroughex = py.builtin._sysex

View File

@ -1,7 +1,6 @@
import sys
import py
BuiltinAssertionError = py.builtin.builtins.AssertionError
from _pytest.assertion.util import BuiltinAssertionError
class AssertionError(BuiltinAssertionError):
def __init__(self, *args):

View File

@ -2,6 +2,7 @@
import py
BuiltinAssertionError = py.builtin.builtins.AssertionError
# The _reprcompare attribute on the util module is used by the new assertion
# interpretation code and assertion rewriter to detect this plugin was

View File

@ -322,3 +322,18 @@ def test_assert_raises_in_nonzero_of_object_pytest_issue10():
e = exvalue()
s = str(e)
assert "<MY42 object> < 0" in s
@py.test.mark.skipif("sys.version_info >= (2,6)")
def test_oldinterpret_importation():
# we had a cyclic import there
# requires pytest on sys.path
res = py.std.subprocess.call([
py.std.sys.executable, '-c', str(py.code.Source("""
try:
from _pytest.assertion.newinterpret import interpret
except ImportError:
from _pytest.assertion.oldinterpret import interpret
"""))
])
assert res == 0