mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-07-30 10:38:07 -07:00
dev-python/py: Fix tests
Closes: https://bugs.gentoo.org/642440 Package-Manager: Portage-2.3.30, Repoman-2.3.9
This commit is contained in:
116
dev-python/py/files/py-1.4.34-skip-broken-pytest3.patch
Normal file
116
dev-python/py/files/py-1.4.34-skip-broken-pytest3.patch
Normal file
@@ -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()
|
||||
assert str(e).find('assert [1, 2, 3] !=') != -1
|
||||
|
||||
-
|
||||
+@py.test.mark.xfail(py.test.__version__[0] != "2",
|
||||
+ reason="broken on modern pytest",
|
||||
+ run=False
|
||||
+)
|
||||
def test_assert_with_brokenrepr_arg():
|
||||
class BrokenRepr:
|
||||
def __repr__(self): 0 / 0
|
||||
@@ -278,7 +281,10 @@ def test_assert_raise_alias(testdir):
|
||||
])
|
||||
|
||||
|
||||
-@pytest.mark.skipif("sys.version_info < (2,5)")
|
||||
+@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():
|
||||
class SomeEx(AssertionError):
|
||||
def __init__(self, *args):
|
||||
--- a/testing/code/test_excinfo.py
|
||||
+++ b/testing/code/test_excinfo.py
|
||||
@@ -16,6 +16,13 @@ else:
|
||||
|
||||
import pytest
|
||||
pytest_version_info = tuple(map(int, pytest.__version__.split(".")[:3]))
|
||||
+
|
||||
+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
|
||||
+ )
|
||||
+
|
||||
|
||||
class TWMock:
|
||||
def __init__(self):
|
||||
@@ -355,6 +362,7 @@ class TestFormattedExcinfo:
|
||||
assert lines[0] == "| def f(x):"
|
||||
assert lines[1] == " pass"
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_repr_source_excinfo(self):
|
||||
""" check if indentation is right """
|
||||
pr = FormattedExcinfo()
|
||||
@@ -657,6 +665,7 @@ raise ValueError()
|
||||
assert p._makepath(__file__) == __file__
|
||||
reprtb = p.repr_traceback(excinfo)
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_repr_excinfo_addouterr(self, importasmod):
|
||||
mod = importasmod("""
|
||||
def entry():
|
||||
@@ -699,6 +708,7 @@ raise ValueError()
|
||||
assert reprtb.extraline == "!!! Recursion detected (same locals & position)"
|
||||
assert str(reprtb)
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_tb_entry_AssertionError(self, importasmod):
|
||||
# probably this test is a bit redundant
|
||||
# as py/magic/testing/test_assertion.py
|
||||
@@ -742,6 +752,7 @@ raise ValueError()
|
||||
x = py.builtin._totext(MyRepr())
|
||||
assert x == py.builtin._totext("я", "utf-8")
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_toterminal_long(self, importasmod):
|
||||
mod = importasmod("""
|
||||
def g(x):
|
||||
@@ -768,6 +779,7 @@ raise ValueError()
|
||||
assert tw.lines[9] == ""
|
||||
assert tw.lines[10].endswith("mod.py:3: ValueError")
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_toterminal_long_missing_source(self, importasmod, tmpdir):
|
||||
mod = importasmod("""
|
||||
def g(x):
|
||||
@@ -793,6 +805,7 @@ raise ValueError()
|
||||
assert tw.lines[7] == ""
|
||||
assert tw.lines[8].endswith("mod.py:3: ValueError")
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_toterminal_long_incomplete_source(self, importasmod, tmpdir):
|
||||
mod = importasmod("""
|
||||
def g(x):
|
||||
@@ -818,6 +831,7 @@ raise ValueError()
|
||||
assert tw.lines[7] == ""
|
||||
assert tw.lines[8].endswith("mod.py:3: ValueError")
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_toterminal_long_filenames(self, importasmod):
|
||||
mod = importasmod("""
|
||||
def f():
|
||||
@@ -863,6 +877,7 @@ raise ValueError()
|
||||
assert tw.stringio.getvalue()
|
||||
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_native_style(self):
|
||||
excinfo = self.excinfo_from_exec("""
|
||||
assert 0
|
||||
@@ -877,6 +892,7 @@ raise ValueError()
|
||||
if py.std.sys.version_info >= (2, 5):
|
||||
assert s.count('assert 0') == 2
|
||||
|
||||
+ @broken_on_modern_pytest
|
||||
def test_traceback_repr_style(self, importasmod):
|
||||
mod = importasmod("""
|
||||
def f():
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user