forked from pool/python-readme_renderer
- update to 32.0:
* Allow start attribute in ordered lists (#216) * No limit rendering RST one column field names (#219) * Render disabled checkboxes from Markdown (#217) * support cmarkgfm>=0.6.0 (#209) OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-readme_renderer?expand=0&rev=16
This commit is contained in:
parent
f4dc362560
commit
e6b558a756
@ -6,6 +6,7 @@ Sun Jan 16 12:48:21 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
|||||||
* No limit rendering RST one column field names (#219)
|
* No limit rendering RST one column field names (#219)
|
||||||
* Render disabled checkboxes from Markdown (#217)
|
* Render disabled checkboxes from Markdown (#217)
|
||||||
* support cmarkgfm>=0.6.0 (#209)
|
* support cmarkgfm>=0.6.0 (#209)
|
||||||
|
- drop remove-mock.patch, remove-six.patch: upstream
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Mon Mar 22 10:45:29 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
Mon Mar 22 10:45:29 UTC 2021 - Ben Greiner <code@bnavigator.de>
|
||||||
|
@ -1,117 +0,0 @@
|
|||||||
From 091bcd67ada85e54b534a71fd63e5997120590a6 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
|
||||||
Date: Tue, 23 Feb 2021 08:32:32 +0100
|
|
||||||
Subject: [PATCH] Use built-in Python 3 unittest.mock module
|
|
||||||
|
|
||||||
Replace the use of external 'mock' package with the 'unittest.mock'
|
|
||||||
module provided by Python 3. Since Python 2 is no longer supported,
|
|
||||||
this eliminates an unnecessary dependency.
|
|
||||||
---
|
|
||||||
tests/test_integration_distutils.py | 26 +++++++++++++-------------
|
|
||||||
tox.ini | 1 -
|
|
||||||
2 files changed, 13 insertions(+), 14 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/tests/test_integration_distutils.py b/tests/test_integration_distutils.py
|
|
||||||
index 8118692..55a857e 100644
|
|
||||||
--- a/tests/test_integration_distutils.py
|
|
||||||
+++ b/tests/test_integration_distutils.py
|
|
||||||
@@ -1,6 +1,6 @@
|
|
||||||
import distutils.dist
|
|
||||||
+import unittest.mock
|
|
||||||
|
|
||||||
-import mock
|
|
||||||
import pytest
|
|
||||||
import setuptools.dist
|
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ def test_valid_rst():
|
|
||||||
dist = distutils.dist.Distribution(attrs=dict(
|
|
||||||
long_description="Hello, I am some text."))
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
@@ -22,14 +22,14 @@ def test_invalid_rst():
|
|
||||||
dist = distutils.dist.Distribution(attrs=dict(
|
|
||||||
long_description="Hello, I am some `totally borked< text."))
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
- checker.announce = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
+ checker.announce = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
# Should warn once for the syntax error, and finally to warn that the
|
|
||||||
# overall syntax is invalid
|
|
||||||
- checker.warn.assert_called_once_with(mock.ANY)
|
|
||||||
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
|
|
||||||
message = checker.warn.call_args[0][0]
|
|
||||||
assert 'invalid markup' in message
|
|
||||||
assert 'line 1: Warning:' in message
|
|
||||||
@@ -47,14 +47,14 @@ def test_malicious_rst():
|
|
||||||
dist = distutils.dist.Distribution(attrs=dict(
|
|
||||||
long_description=description))
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
- checker.announce = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
+ checker.announce = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
# Should warn once for the syntax error, and finally to warn that the
|
|
||||||
# overall syntax is invalid
|
|
||||||
- checker.warn.assert_called_once_with(mock.ANY)
|
|
||||||
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
|
|
||||||
message = checker.warn.call_args[0][0]
|
|
||||||
assert 'directive disabled' in message
|
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ def test_markdown():
|
|
||||||
long_description="Hello, I am some text.",
|
|
||||||
long_description_content_type="text/markdown"))
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
@@ -79,11 +79,11 @@ def test_markdown():
|
|
||||||
def test_invalid_missing():
|
|
||||||
dist = distutils.dist.Distribution(attrs=dict())
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
- checker.warn.assert_called_once_with(mock.ANY)
|
|
||||||
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
|
|
||||||
assert 'missing' in checker.warn.call_args[0][0]
|
|
||||||
|
|
||||||
|
|
||||||
@@ -91,9 +91,9 @@ def test_invalid_empty():
|
|
||||||
dist = distutils.dist.Distribution(attrs=dict(
|
|
||||||
long_description=""))
|
|
||||||
checker = readme_renderer.integration.distutils.Check(dist)
|
|
||||||
- checker.warn = mock.Mock()
|
|
||||||
+ checker.warn = unittest.mock.Mock()
|
|
||||||
|
|
||||||
checker.check_restructuredtext()
|
|
||||||
|
|
||||||
- checker.warn.assert_called_once_with(mock.ANY)
|
|
||||||
+ checker.warn.assert_called_once_with(unittest.mock.ANY)
|
|
||||||
assert 'missing' in checker.warn.call_args[0][0]
|
|
||||||
diff --git a/tox.ini b/tox.ini
|
|
||||||
index 70fdc66..5edb19f 100644
|
|
||||||
--- a/tox.ini
|
|
||||||
+++ b/tox.ini
|
|
||||||
@@ -4,7 +4,6 @@ envlist = py36,py37,py38,py39,pep8,packaging,noextra
|
|
||||||
[testenv]
|
|
||||||
deps =
|
|
||||||
pytest
|
|
||||||
- mock
|
|
||||||
commands =
|
|
||||||
py.test --strict {posargs}
|
|
||||||
extras = md
|
|
@ -1,90 +0,0 @@
|
|||||||
From 690e5248960280232315f804e1f0c6bf7a1d3348 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
|
|
||||||
Date: Tue, 23 Feb 2021 08:58:46 +0100
|
|
||||||
Subject: [PATCH] Remove the use of six since only Python 3 is supported
|
|
||||||
|
|
||||||
---
|
|
||||||
readme_renderer/integration/distutils.py | 2 --
|
|
||||||
readme_renderer/markdown.py | 9 ++-------
|
|
||||||
setup.py | 2 +-
|
|
||||||
tests/test_rst.py | 3 +--
|
|
||||||
4 files changed, 4 insertions(+), 12 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/readme_renderer/integration/distutils.py b/readme_renderer/integration/distutils.py
|
|
||||||
index 98d0f08..eb04460 100644
|
|
||||||
--- a/readme_renderer/integration/distutils.py
|
|
||||||
+++ b/readme_renderer/integration/distutils.py
|
|
||||||
@@ -20,7 +20,6 @@
|
|
||||||
import distutils.log
|
|
||||||
from distutils.command.check import check as _check
|
|
||||||
from distutils.core import Command
|
|
||||||
-import six
|
|
||||||
|
|
||||||
from ..rst import render
|
|
||||||
|
|
||||||
@@ -35,7 +34,6 @@
|
|
||||||
r'(?P<message>.*)', re.DOTALL | re.MULTILINE)
|
|
||||||
|
|
||||||
|
|
||||||
-@six.python_2_unicode_compatible
|
|
||||||
class _WarningStream(object):
|
|
||||||
def __init__(self):
|
|
||||||
self.output = io.StringIO()
|
|
||||||
diff --git a/readme_renderer/markdown.py b/readme_renderer/markdown.py
|
|
||||||
index ca2f03f..ae32539 100644
|
|
||||||
--- a/readme_renderer/markdown.py
|
|
||||||
+++ b/readme_renderer/markdown.py
|
|
||||||
@@ -16,17 +16,12 @@
|
|
||||||
import re
|
|
||||||
import warnings
|
|
||||||
|
|
||||||
+from html.parser import unescape
|
|
||||||
+
|
|
||||||
import pygments
|
|
||||||
import pygments.lexers
|
|
||||||
import pygments.formatters
|
|
||||||
|
|
||||||
-try:
|
|
||||||
- from six.moves.html_parser import unescape
|
|
||||||
-except ImportError: # Python 2
|
|
||||||
- from six.moves import html_parser
|
|
||||||
-
|
|
||||||
- unescape = html_parser.HTMLParser().unescape
|
|
||||||
-
|
|
||||||
from .clean import clean
|
|
||||||
|
|
||||||
_EXTRA_WARNING = (
|
|
||||||
diff --git a/setup.py b/setup.py
|
|
||||||
index ff1feaf..c8e35c1 100644
|
|
||||||
--- a/setup.py
|
|
||||||
+++ b/setup.py
|
|
||||||
@@ -55,7 +55,7 @@
|
|
||||||
"Programming Language :: Python :: Implementation :: CPython",
|
|
||||||
"Programming Language :: Python :: Implementation :: PyPy",
|
|
||||||
],
|
|
||||||
- install_requires=["bleach>=2.1.0", "docutils>=0.13.1", "Pygments>=2.5.1", "six"],
|
|
||||||
+ install_requires=["bleach>=2.1.0", "docutils>=0.13.1", "Pygments>=2.5.1"],
|
|
||||||
entry_points={
|
|
||||||
"distutils.commands": ["check = readme_renderer.integration.distutils:Check"],
|
|
||||||
},
|
|
||||||
diff --git a/tests/test_rst.py b/tests/test_rst.py
|
|
||||||
index 3de3dbf..64e552c 100755
|
|
||||||
--- a/tests/test_rst.py
|
|
||||||
+++ b/tests/test_rst.py
|
|
||||||
@@ -3,7 +3,6 @@
|
|
||||||
import os.path
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
-import six
|
|
||||||
|
|
||||||
from readme_renderer.rst import render
|
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ def test_rst_002():
|
|
||||||
|
|
||||||
|
|
||||||
def test_rst_raw():
|
|
||||||
- warnings = six.StringIO()
|
|
||||||
+ warnings = io.StringIO()
|
|
||||||
assert render("""
|
|
||||||
.. raw:: html
|
|
||||||
<script>I am evil</script>
|
|
Loading…
x
Reference in New Issue
Block a user