summaryrefslogtreecommitdiff
blob: 67b1f4eb95acb181dd200976c881c3c6586a2129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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():