dev-python/py: Fix tests
authorThomas Deutschmann <whissi@gentoo.org>
Wed, 18 Apr 2018 13:17:51 +0000 (15:17 +0200)
committerThomas Deutschmann <whissi@gentoo.org>
Wed, 18 Apr 2018 13:22:02 +0000 (15:22 +0200)
Closes: https://bugs.gentoo.org/642440
Package-Manager: Portage-2.3.30, Repoman-2.3.9

dev-python/py/files/py-1.4.34-skip-broken-pytest3.patch [new file with mode: 0644]
dev-python/py/py-1.4.34.ebuild

diff --git a/dev-python/py/files/py-1.4.34-skip-broken-pytest3.patch b/dev-python/py/files/py-1.4.34-skip-broken-pytest3.patch
new file mode 100644 (file)
index 0000000..67b1f4e
--- /dev/null
@@ -0,0 +1,116 @@
+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
index 82fcf480f53847f9d910d2bdc1883242e5b205d9..e6fadf662a34404de37066f938919868ead2b518 100644 (file)
@@ -22,6 +22,8 @@ DEPEND="
        test? ( >=dev-python/pytest-2.4.2[${PYTHON_USEDEP}] )
        doc? ( dev-python/sphinx[${PYTHON_USEDEP}] )"
 
+PATCHES=( "${FILESDIR}"/${PN}-1.4.34-skip-broken-pytest3.patch )
+
 python_prepare_all() {
        sed -e 's:intersphinx_mapping:#&:' -i doc/conf.py || die
        distutils-r1_python_prepare_all