Skip to content

Commit 9946c92

Browse files
committed
tests: update dealine time for pypy
1 parent 4009f67 commit 9946c92

2 files changed

Lines changed: 9 additions & 20 deletions

File tree

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,7 @@ A fast yet powerful Python Markdown parser with renderers and plugins.
2525
>
2626
> In the current benchmark suite, Wenmode’s core Markdown-to-HTML path is about 1.5-1.8x as fast as Mistune across the tested documentation corpora. See the [benchmark results](https://wenmode.lepture.com/benchmarks/) for the exact setup and numbers.
2727
28-
## Paid plugins
29-
30-
You can ask me to create a custom mistune plugin or directive for your needs with GitHub sponsor
31-
[one time tier (Mistune enhance)](https://github.com/sponsors/lepture/sponsorships?tier_id=220664)
32-
33-
## Sponsors
34-
35-
<table>
36-
<tr>
37-
<td><img align="middle" width="64" src="https://typlog.com/android-chrome-512x512.png"></td>
38-
<td>Mistune is sponsored by Typlog, a blogging and podcast hosting platform, simple yet powerful. <a href="https://typlog.com/?utm_source=mistune&utm_medium=referral&utm_campaign=readme">Write in Markdown</a>.
39-
</td>
40-
</tr>
41-
</table>
42-
43-
[**Support Me via GitHub Sponsors**](https://github.com/sponsors/lepture).
28+
Check [benchmark results for Wenmode](https://github.com/lepture/wenmode#benchmark).
4429

4530
## Install
4631

tests/test_security_inline.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
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+
DEADLINE = 1.0 if IS_PYPY else 0.5
9+
610

711
class TestInlineParserSecurity(TestCase):
812
def test_link_title_redos_payload_returns_quickly(self):
@@ -13,7 +17,7 @@ def test_link_title_redos_payload_returns_quickly(self):
1317
html = md(payload)
1418
elapsed = time.monotonic() - start
1519

16-
self.assertLess(elapsed, 0.5)
20+
self.assertLess(elapsed, DEADLINE)
1721
self.assertIn("[x](y", html)
1822

1923
def test_nested_bracket_link_input_does_not_recurse_forever(self):
@@ -23,7 +27,7 @@ def test_nested_bracket_link_input_does_not_recurse_forever(self):
2327
html = create_markdown()(text)
2428
elapsed = time.monotonic() - start
2529

26-
self.assertLess(elapsed, 0.5)
30+
self.assertLess(elapsed, DEADLINE)
2731
self.assertIn("[", html)
2832

2933
def test_failed_outer_bracket_preserves_nested_link(self):
@@ -38,7 +42,7 @@ def test_failed_reference_after_nested_brackets_returns_quickly(self):
3842
html = create_markdown()(text)
3943
elapsed = time.monotonic() - start
4044

41-
self.assertLess(elapsed, 0.5)
45+
self.assertLess(elapsed, DEADLINE)
4246
self.assertIn("[missing]", html)
4347

4448
def test_failed_reference_does_not_hide_following_inline_link(self):
@@ -53,5 +57,5 @@ def test_unmatched_bracket_input_returns_quickly(self):
5357
html = create_markdown()(text)
5458
elapsed = time.monotonic() - start
5559

56-
self.assertLess(elapsed, 0.5)
60+
self.assertLess(elapsed, DEADLINE)
5761
self.assertIn("[", html)

0 commit comments

Comments
 (0)