Skip to content

Commit bdc01ad

Browse files
committed
tests: increase run time on pypy
1 parent 7cf1814 commit bdc01ad

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

‎tests/test_security_ref_links.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1+
import platform
12
import time
23
from unittest import TestCase
34

45
from mistune import create_markdown
56

7+
IS_PYPY = platform.python_implementation() == "PyPy"
8+
69

710
class TestRefLinkSecurity(TestCase):
811
def test_many_reference_links_return_quickly(self):
9-
text = "".join("[a{}]: u\n".format(i) for i in range(3000))
12+
repetitions = 500 if IS_PYPY else 3000
13+
deadline = 1.0 if IS_PYPY else 0.5
14+
15+
text = "".join("[a{}]: u\n".format(i) for i in range(repetitions))
1016

1117
start = time.monotonic()
1218
create_markdown()(text)
1319
elapsed = time.monotonic() - start
1420

15-
self.assertLess(elapsed, 0.5)
21+
self.assertLess(elapsed, deadline)

0 commit comments

Comments
 (0)