##// END OF EJS Templates
Tweak tests for PyPy and add CI runner...
Nikita Kniazev -
Show More
@@ -33,6 +33,16 b' jobs:'
33 33 - os: ubuntu-latest
34 34 python-version: "3.11-dev"
35 35 deps: test
36 # Installing optional dependencies stuff takes ages on PyPy
37 - os: ubuntu-latest
38 python-version: "pypy-3.8"
39 deps: test
40 - os: windows-latest
41 python-version: "pypy-3.8"
42 deps: test
43 - os: macos-latest
44 python-version: "pypy-3.8"
45 deps: test
36 46
37 47 steps:
38 48 - uses: actions/checkout@v2
@@ -3,6 +3,7 b' Test for async helpers.'
3 3
4 4 Should only trigger on python 3.5+ or will have syntax errors.
5 5 """
6 import platform
6 7 from itertools import chain, repeat
7 8 from textwrap import dedent, indent
8 9 from unittest import TestCase
@@ -275,7 +276,7 b' class AsyncTest(TestCase):'
275 276 """
276 277 )
277 278
278 if sys.version_info < (3,9):
279 if sys.version_info < (3, 9) and platform.python_implementation() != "PyPy":
279 280 # new pgen parser in 3.9 does not raise MemoryError on too many nested
280 281 # parens anymore
281 282 def test_memory_error(self):
@@ -371,11 +371,13 b' def _decorator_skip_setup():'
371 371 child = pexpect.spawn(
372 372 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
373 373 )
374 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
374 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
375 375
376 376 child.expect("IPython")
377 377 child.expect("\n")
378 378
379 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
380
379 381 dedented_blocks = [dedent(b).strip() for b in skip_decorators_blocks]
380 382 in_prompt_number = 1
381 383 for cblock in dedented_blocks:
@@ -448,11 +450,13 b' def test_decorator_skip_with_breakpoint():'
448 450 child = pexpect.spawn(
449 451 sys.executable, ["-m", "IPython", "--colors=nocolor"], env=env
450 452 )
451 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
453 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
452 454
453 455 child.expect("IPython")
454 456 child.expect("\n")
455 457
458 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
459
456 460 ### we need a filename, so we need to exec the full block with a filename
457 461 with NamedTemporaryFile(suffix=".py", dir=".", delete=True) as tf:
458 462
@@ -2,6 +2,7 b''
2 2 """Tests for various magic functions."""
3 3
4 4 import asyncio
5 import gc
5 6 import io
6 7 import os
7 8 import re
@@ -576,6 +577,7 b' class TestXdel(tt.TempFileMixin):'
576 577 _ip.magic("xdel a")
577 578
578 579 # Check that a's __del__ method has been called.
580 gc.collect(0)
579 581 assert monitor == [1]
580 582
581 583 def doctest_who():
@@ -18,6 +18,7 b' as otherwise it may influence later tests.'
18 18
19 19 import functools
20 20 import os
21 import platform
21 22 from os.path import join as pjoin
22 23 import random
23 24 import string
@@ -158,7 +159,7 b' def doctest_reset_del():'
158 159
159 160 In [3]: a = A()
160 161
161 In [4]: get_ipython().reset()
162 In [4]: get_ipython().reset(); import gc; x = gc.collect(0)
162 163 Hi
163 164
164 165 In [5]: 1+1
@@ -241,6 +242,10 b' class TestMagicRunSimple(tt.TempFileMixin):'
241 242 _ip.run_cell("t = isinstance(f(), foo)")
242 243 assert _ip.user_ns["t"] is True
243 244
245 @pytest.mark.xfail(
246 platform.python_implementation() == "PyPy",
247 reason="expecting __del__ call on exit is unreliable and doesn't happen on PyPy",
248 )
244 249 def test_obj_del(self):
245 250 """Test that object's __del__ methods are called on exit."""
246 251 src = ("class A(object):\n"
@@ -286,14 +291,20 b' class TestMagicRunSimple(tt.TempFileMixin):'
286 291 _ip.magic("run %s" % empty.fname)
287 292 assert _ip.user_ns["afunc"]() == 1
288 293
289 @dec.skip_win32
290 294 def test_tclass(self):
291 295 mydir = os.path.dirname(__file__)
292 tc = os.path.join(mydir, 'tclass')
293 src = ("%%run '%s' C-first\n"
294 "%%run '%s' C-second\n"
295 "%%run '%s' C-third\n") % (tc, tc, tc)
296 self.mktmp(src, '.ipy')
296 tc = os.path.join(mydir, "tclass")
297 src = f"""\
298 import gc
299 %run "{tc}" C-first
300 gc.collect(0)
301 %run "{tc}" C-second
302 gc.collect(0)
303 %run "{tc}" C-third
304 gc.collect(0)
305 %reset -f
306 """
307 self.mktmp(src, ".ipy")
297 308 out = """\
298 309 ARGV 1-: ['C-first']
299 310 ARGV 1-: ['C-second']
@@ -3,6 +3,7 b''
3 3 """
4 4 import io
5 5 import logging
6 import platform
6 7 import re
7 8 import sys
8 9 import os.path
@@ -248,7 +249,8 b' bar()'
248 249 ip.showsyntaxerror()
249 250
250 251 import sys
251 if sys.version_info < (3,9):
252
253 if sys.version_info < (3, 9) and platform.python_implementation() != "PyPy":
252 254 """
253 255 New 3.9 Pgen Parser does not raise Memory error, except on failed malloc.
254 256 """
@@ -359,7 +361,7 b' def r3o2():'
359 361 ):
360 362 ip.run_cell("r1()")
361 363
362 @recursionlimit(200)
364 @recursionlimit(160)
363 365 def test_recursion_three_frames(self):
364 366 with tt.AssertPrints("[... skipping similar frames: "), \
365 367 tt.AssertPrints(re.compile(r"r3a at line 8 \(\d{2} times\)"), suppress=False), \
@@ -13,6 +13,8 b''
13 13 # -----------------------------------------------------------------------------
14 14
15 15 import os
16 import platform
17 import pytest
16 18 import sys
17 19 import tempfile
18 20 import textwrap
@@ -28,6 +30,12 b' from unittest import TestCase'
28 30 from IPython.extensions.autoreload import AutoreloadMagics
29 31 from IPython.core.events import EventManager, pre_run_cell
30 32
33 if platform.python_implementation() == "PyPy":
34 pytest.skip(
35 "Current autoreload implementation is extremly slow on PyPy",
36 allow_module_level=True,
37 )
38
31 39 # -----------------------------------------------------------------------------
32 40 # Test fixture
33 41 # -----------------------------------------------------------------------------
@@ -51,6 +51,8 b' def test_debug_magic_passes_through_generators():'
51 51 child.sendline(" pass")
52 52 child.sendline("")
53 53
54 child.timeout = 10 * IPYTHON_TESTING_TIMEOUT_SCALE
55
54 56 child.expect('Exception:')
55 57
56 58 child.expect(in_prompt)
@@ -74,8 +74,9 b' def test_nest_embed():'
74 74
75 75 child = pexpect.spawn(sys.executable, ['-m', 'IPython', '--colors=nocolor'],
76 76 env=env)
77 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
77 child.timeout = 15 * IPYTHON_TESTING_TIMEOUT_SCALE
78 78 child.expect(ipy_prompt)
79 child.timeout = 5 * IPYTHON_TESTING_TIMEOUT_SCALE
79 80 child.sendline("import IPython")
80 81 child.expect(ipy_prompt)
81 82 child.sendline("ip0 = get_ipython()")
@@ -37,10 +37,3 b' def doctest_ivars():'
37 37 In [6]: zz
38 38 Out[6]: 1
39 39 """
40
41 def doctest_refs():
42 """DocTest reference holding issues when running scripts.
43
44 In [32]: run show_refs.py
45 c referrers: [<... 'dict'>]
46 """
@@ -131,7 +131,7 b' class Struct(dict):'
131 131 >>> s.a
132 132 10
133 133 >>> type(s.get)
134 <... 'builtin_function_or_method'>
134 <...method'>
135 135 >>> try:
136 136 ... s.b
137 137 ... except AttributeError:
1 NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now