fix a import strange loop that affects pypy test appsupport on python2.5
This commit is contained in:
parent
b92176024c
commit
d02eaa8881
|
@ -1,8 +1,7 @@
|
||||||
import py
|
import py
|
||||||
import sys, inspect
|
import sys, inspect
|
||||||
from compiler import parse, ast, pycodegen
|
from compiler import parse, ast, pycodegen
|
||||||
from _pytest.assertion.util import format_explanation
|
from _pytest.assertion.util import format_explanation, BuiltinAssertionError
|
||||||
from _pytest.assertion.reinterpret import BuiltinAssertionError
|
|
||||||
|
|
||||||
passthroughex = py.builtin._sysex
|
passthroughex = py.builtin._sysex
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import sys
|
import sys
|
||||||
import py
|
import py
|
||||||
|
from _pytest.assertion.util import BuiltinAssertionError
|
||||||
BuiltinAssertionError = py.builtin.builtins.AssertionError
|
|
||||||
|
|
||||||
class AssertionError(BuiltinAssertionError):
|
class AssertionError(BuiltinAssertionError):
|
||||||
def __init__(self, *args):
|
def __init__(self, *args):
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
import py
|
import py
|
||||||
|
|
||||||
|
BuiltinAssertionError = py.builtin.builtins.AssertionError
|
||||||
|
|
||||||
# The _reprcompare attribute on the util module is used by the new assertion
|
# The _reprcompare attribute on the util module is used by the new assertion
|
||||||
# interpretation code and assertion rewriter to detect this plugin was
|
# interpretation code and assertion rewriter to detect this plugin was
|
||||||
|
|
|
@ -322,3 +322,18 @@ def test_assert_raises_in_nonzero_of_object_pytest_issue10():
|
||||||
e = exvalue()
|
e = exvalue()
|
||||||
s = str(e)
|
s = str(e)
|
||||||
assert "<MY42 object> < 0" in s
|
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
|
||||||
|
|
Loading…
Reference in New Issue