##// END OF EJS Templates
Backport PR #13270: Add Xfail test on 3.9.8
Matthias Bussonnier -
Show More
@@ -14,6 +14,7 b' from IPython.core import inputsplitter as isp'
14 from IPython.core.inputtransformer import InputTransformer
14 from IPython.core.inputtransformer import InputTransformer
15 from IPython.core.tests.test_inputtransformer import syntax, syntax_ml
15 from IPython.core.tests.test_inputtransformer import syntax, syntax_ml
16 from IPython.testing import tools as tt
16 from IPython.testing import tools as tt
17 from IPython.testing.decorators import skipif
17
18
18 #-----------------------------------------------------------------------------
19 #-----------------------------------------------------------------------------
19 # Semi-complete examples (also used as tests)
20 # Semi-complete examples (also used as tests)
@@ -323,6 +324,7 b' class InputSplitterTestCase(unittest.TestCase):'
323 self.isp.push(u'\xc3\xa9')
324 self.isp.push(u'\xc3\xa9')
324 self.isp.push(u"u'\xc3\xa9'")
325 self.isp.push(u"u'\xc3\xa9'")
325
326
327 @skipif(sys.version_info[:3] == (3, 9, 8))
326 def test_line_continuation(self):
328 def test_line_continuation(self):
327 """ Test issue #2108."""
329 """ Test issue #2108."""
328 isp = self.isp
330 isp = self.isp
@@ -6,11 +6,14 b' transformations.'
6 """
6 """
7 import nose.tools as nt
7 import nose.tools as nt
8 import string
8 import string
9 import sys
10 from textwrap import dedent
9
11
10 from IPython.core import inputtransformer2 as ipt2
12 import pytest
11 from IPython.core.inputtransformer2 import make_tokens_by_line, _find_assign_op
12
13
13 from textwrap import dedent
14 from IPython.core import inputtransformer2 as ipt2
15 from IPython.core.inputtransformer2 import _find_assign_op, make_tokens_by_line
16 from IPython.testing.decorators import skip
14
17
15 MULTILINE_MAGIC = ("""\
18 MULTILINE_MAGIC = ("""\
16 a = f()
19 a = f()
@@ -253,20 +256,38 b' def test_find_assign_op_dedent():'
253 nt.assert_equal(_find_assign_op([Tk(s) for s in ('','a','=','b')]), 2)
256 nt.assert_equal(_find_assign_op([Tk(s) for s in ('','a','=','b')]), 2)
254 nt.assert_equal(_find_assign_op([Tk(s) for s in ('','(', 'a','=','b', ')', '=' ,'5')]), 6)
257 nt.assert_equal(_find_assign_op([Tk(s) for s in ('','(', 'a','=','b', ')', '=' ,'5')]), 6)
255
258
259 examples = [
260 pytest.param("a = 1", "complete", None),
261 pytest.param("for a in range(5):", "incomplete", 4),
262 pytest.param("for a in range(5):\n if a > 0:", "incomplete", 8),
263 pytest.param("raise = 2", "invalid", None),
264 pytest.param("a = [1,\n2,", "incomplete", 0),
265 pytest.param("(\n))", "incomplete", 0),
266 pytest.param("\\\r\n", "incomplete", 0),
267 pytest.param("a = '''\n hi", "incomplete", 3),
268 pytest.param("def a():\n x=1\n global x", "invalid", None),
269 pytest.param(
270 "a \\ ",
271 "invalid",
272 None,
273 marks=pytest.mark.xfail(
274 reason="Bug in python 3.9.8 – bpo 45738",
275 condition=sys.version_info[:3] == (3, 9, 8),
276 raises=SystemError,
277 strict=True,
278 ),
279 ), # Nothing allowed after backslash,
280 pytest.param("1\\\n+2", "complete", None),
281 ]
282
283
284 @skip('Tested on master, skip only on iptest not available on 7.x')
285 @pytest.mark.xfail(
286 reason="Bug in python 3.9.8 – bpo 45738",
287 condition=sys.version_info[:3] == (3, 9, 8),
288 )
256 def test_check_complete():
289 def test_check_complete():
257 cc = ipt2.TransformerManager().check_complete
290 cc = ipt2.TransformerManager().check_complete
258 nt.assert_equal(cc("a = 1"), ('complete', None))
259 nt.assert_equal(cc("for a in range(5):"), ('incomplete', 4))
260 nt.assert_equal(cc("for a in range(5):\n if a > 0:"), ('incomplete', 8))
261 nt.assert_equal(cc("raise = 2"), ('invalid', None))
262 nt.assert_equal(cc("a = [1,\n2,"), ('incomplete', 0))
263 nt.assert_equal(cc(")"), ('incomplete', 0))
264 nt.assert_equal(cc("\\\r\n"), ('incomplete', 0))
265 nt.assert_equal(cc("a = '''\n hi"), ('incomplete', 3))
266 nt.assert_equal(cc("def a():\n x=1\n global x"), ('invalid', None))
267 nt.assert_equal(cc("a \\ "), ('invalid', None)) # Nothing allowed after backslash
268 nt.assert_equal(cc("1\\\n+2"), ('complete', None))
269 nt.assert_equal(cc("exit"), ('complete', None))
270
291
271 example = dedent("""
292 example = dedent("""
272 if True:
293 if True:
@@ -1,9 +1,26 b''
1 coverage:
1 coverage:
2 status:
2 status:
3 patch: off
3 project:
4 project:
4 default:
5 default: false
6 library:
5 target: auto
7 target: auto
6 threshold: 10
8 paths: ['!.*/tests/.*']
7 patch:
9 threshold: 0.1%
8 default:
10 tests:
9 target: 0%
11 target: auto
12 paths: ['.*/tests/.*']
13 codecov:
14 require_ci_to_pass: false
15
16 ignore:
17 - IPython/kernel/*
18 - IPython/consoleapp.py
19 - IPython/core/inputsplitter.py
20 - IPython/lib/inputhook*.py
21 - IPython/lib/kernel.py
22 - IPython/utils/jsonutil.py
23 - IPython/utils/localinterfaces.py
24 - IPython/utils/log.py
25 - IPython/utils/signatures.py
26 - IPython/utils/traitlets.py
General Comments 0
You need to be logged in to leave comments. Login now