--- /dev/null
+Backport of https://github.com/pytest-dev/py/commit/3305183b964bded36f9cd43976d22524f6ae15b2
+
+--- a/testing/code/test_assertion.py
++++ b/testing/code/test_assertion.py
+@@ -141,7 +141,10 @@ def test_assert_implicit_multiline():
+ e = exvalue()\r
+ assert str(e).find('assert [1, 2, 3] !=') != -1\r
+ \r
+-\r
++@py.test.mark.xfail(py.test.__version__[0] != "2",
++ reason="broken on modern pytest",
++ run=False
++)
+ def test_assert_with_brokenrepr_arg():\r
+ class BrokenRepr:\r
+ def __repr__(self): 0 / 0\r
+@@ -278,7 +281,10 @@ def test_assert_raise_alias(testdir):
+ ])\r
+ \r
+ \r
+-@pytest.mark.skipif("sys.version_info < (2,5)")\r
++@py.test.mark.xfail(py.test.__version__[0] != "2",
++ reason="broken on modern pytest",
++ run=False)
++@py.test.mark.skipif("sys.version_info < (2,5)")
+ def test_assert_raise_subclass():\r
+ class SomeEx(AssertionError):\r
+ def __init__(self, *args):\r
+--- a/testing/code/test_excinfo.py
++++ b/testing/code/test_excinfo.py
+@@ -16,6 +16,13 @@ else:
+ \r
+ import pytest\r
+ pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))\r
++
++broken_on_modern_pytest = pytest.mark.xfail(
++ pytest_version_info[0] != 2,
++ reason="this test hasn't been fixed after moving py.code into pytest",
++ run=False
++ )
++
+ \r
+ class TWMock:\r
+ def __init__(self):\r
+@@ -355,6 +362,7 @@ class TestFormattedExcinfo:
+ assert lines[0] == "| def f(x):"\r
+ assert lines[1] == " pass"\r
+ \r
++ @broken_on_modern_pytest
+ def test_repr_source_excinfo(self):\r
+ """ check if indentation is right """\r
+ pr = FormattedExcinfo()\r
+@@ -657,6 +665,7 @@ raise ValueError()
+ assert p._makepath(__file__) == __file__\r
+ reprtb = p.repr_traceback(excinfo)\r
+ \r
++ @broken_on_modern_pytest
+ def test_repr_excinfo_addouterr(self, importasmod):\r
+ mod = importasmod("""\r
+ def entry():\r
+@@ -699,6 +708,7 @@ raise ValueError()
+ assert reprtb.extraline == "!!! Recursion detected (same locals & position)"\r
+ assert str(reprtb)\r
+ \r
++ @broken_on_modern_pytest
+ def test_tb_entry_AssertionError(self, importasmod):\r
+ # probably this test is a bit redundant\r
+ # as py/magic/testing/test_assertion.py\r
+@@ -742,6 +752,7 @@ raise ValueError()
+ x = py.builtin._totext(MyRepr())\r
+ assert x == py.builtin._totext("я", "utf-8")\r
+ \r
++ @broken_on_modern_pytest
+ def test_toterminal_long(self, importasmod):\r
+ mod = importasmod("""\r
+ def g(x):\r
+@@ -768,6 +779,7 @@ raise ValueError()
+ assert tw.lines[9] == ""\r
+ assert tw.lines[10].endswith("mod.py:3: ValueError")\r
+ \r
++ @broken_on_modern_pytest
+ def test_toterminal_long_missing_source(self, importasmod, tmpdir):\r
+ mod = importasmod("""\r
+ def g(x):\r
+@@ -793,6 +805,7 @@ raise ValueError()
+ assert tw.lines[7] == ""\r
+ assert tw.lines[8].endswith("mod.py:3: ValueError")\r
+ \r
++ @broken_on_modern_pytest
+ def test_toterminal_long_incomplete_source(self, importasmod, tmpdir):\r
+ mod = importasmod("""\r
+ def g(x):\r
+@@ -818,6 +831,7 @@ raise ValueError()
+ assert tw.lines[7] == ""\r
+ assert tw.lines[8].endswith("mod.py:3: ValueError")\r
+ \r
++ @broken_on_modern_pytest
+ def test_toterminal_long_filenames(self, importasmod):\r
+ mod = importasmod("""\r
+ def f():\r
+@@ -863,6 +877,7 @@ raise ValueError()
+ assert tw.stringio.getvalue()\r
+ \r
+ \r
++ @broken_on_modern_pytest
+ def test_native_style(self):\r
+ excinfo = self.excinfo_from_exec("""\r
+ assert 0\r
+@@ -877,6 +892,7 @@ raise ValueError()
+ if py.std.sys.version_info >= (2, 5):\r
+ assert s.count('assert 0') == 2\r
+ \r
++ @broken_on_modern_pytest
+ def test_traceback_repr_style(self, importasmod):\r
+ mod = importasmod("""\r
+ def f():\r