This is macOS with python3.10. Unfortunately, it's for readme-renderer-v41 because I can't update to 42 which needs nh3, which needs rust, which I don't have.
Test results
```
_____________________________________________________________ test_cli_input_file[test_rst_003.rst-False] _____________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = False
@pytest.mark.parametrize("output_file", [False, True])
def test_cli_input_file(input_file, output_file):
with mock.patch("builtins.print") as print_:
if output_file:
with tempfile.TemporaryDirectory() as tmpdir:
output = pathlib.Path(tmpdir) / "output.html"
main(["-o", str(output), str(input_file)])
with output.open() as fp:
result = fp.read()
else:
main([str(input_file)])
print_.assert_called_once()
(result,), kwargs = print_.call_args
with input_file.with_suffix(".html").open() as fp:
expected = fp.read()
> assert result.strip() == expected.strip()
E assert equals failed
E '
\n
Required packages
\n '\n
Required packages
\n
To run th
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\n
\n\n\n
\n
Quick developmen ion id="quick-development-setup">\n
Quick development setup
\n
Mak
E t setup\n
Make sure you are sitting
\n
' e sure you are sitting\n'
tests/test_cli.py:35: AssertionError
_____________________________________________________________ test_cli_input_file[test_rst_003.rst-True] ______________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = True
@pytest.mark.parametrize("output_file", [False, True])
def test_cli_input_file(input_file, output_file):
with mock.patch("builtins.print") as print_:
if output_file:
with tempfile.TemporaryDirectory() as tmpdir:
output = pathlib.Path(tmpdir) / "output.html"
main(["-o", str(output), str(input_file)])
with output.open() as fp:
result = fp.read()
else:
main([str(input_file)])
print_.assert_called_once()
(result,), kwargs = print_.call_args
with input_file.with_suffix(".html").open() as fp:
expected = fp.read()
> assert result.strip() == expected.strip()
E assert equals failed
E '
\n
Required packages
\n '\n
Required packages
\n
To run th
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\n
\n\n\n
\n
Quick developmen ion id="quick-development-setup">\n
Quick development setup
\n
Mak
E t setup\n
Make sure you are sitting
\n
' e sure you are sitting\n'
tests/test_cli.py:35: AssertionError
_____________________________________________________________ test_cli_explicit_format[test_rst_003.rst] ______________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst')
def test_cli_explicit_format(input_file):
fmt = input_file.suffix.lstrip(".")
with input_file.open() as fp, \
mock.patch("pathlib.Path.open", return_value=fp), \
mock.patch("builtins.print") as print_:
main(["-f", fmt, "no-file.invalid"])
print_.assert_called_once()
(result,), _ = print_.call_args
with input_file.with_suffix(".html").open() as fp:
> assert result.strip() == fp.read().strip()
E assert equals failed
E '
\n
Required packages
\n '\n
Required packages
\n
To run th
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\n
\n\n\n
\n
Quick developmen ion id="quick-development-setup">\n
Quick development setup
\n
Mak
E t setup\n
Make sure you are sitting
\n
' e sure you are sitting\n'
tests/test_cli.py:57: AssertionError
________________________________________ test_cli_package[docutils-Docutils is a modular system for processing documentation] _________________________________________
package = 'docutils', contains = 'Docutils is a modular system for processing documentation'
@pytest.mark.parametrize("package, contains", [
("readme_renderer", "Readme Renderer is a library that will safely render"),
("docutils", "Docutils is a modular system for processing documentation"),
])
def test_cli_package(package, contains):
with mock.patch("builtins.print") as print_:
> main(["-p", package])
tests/test_cli.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cli_args = ['-p', 'docutils']
def main(cli_args: Optional[List[str]] = None) -> None:
parser = argparse.ArgumentParser(
description="Renders a .md, .rst, or .txt README to HTML",
)
parser.add_argument("-p", "--package", help="Get README from package metadata",
action="store_true")
parser.add_argument("-f", "--format", choices=["md", "rst", "txt"],
help="README format (inferred from input file name or package)")
parser.add_argument('input', help="Input README file or package name")
parser.add_argument('-o', '--output', help="Output file (default: stdout)",
type=argparse.FileType('w'), default='-')
args = parser.parse_args(cli_args)
content_format = args.format
if args.package:
message = metadata(args.input)
source = message.get_payload() # type: ignore[attr-defined] # noqa: E501 https://peps.python.org/pep-0566/
# Infer the format of the description from package metadata.
if not content_format:
content_type = message.get("Description-Content-Type", "text/x-rst") # type: ignore[attr-defined] # noqa: E501 https://github.com/python/typeshed/issues/10021
if content_type == "text/x-rst":
content_format = "rst"
elif content_type == "text/markdown":
content_format = "md"
elif content_type == "text/plain":
content_format = "txt"
else:
raise ValueError(f"invalid content type {content_type} for package "
"`long_description`")
else:
filename = pathlib.Path(args.input)
content_format = content_format or filename.suffix.lstrip(".")
with filename.open() as fp:
source = fp.read()
if content_format == "md":
rendered = render_md(source, stream=sys.stderr)
elif content_format == "rst":
rendered = render_rst(source, stream=sys.stderr)
elif content_format == "txt":
rendered = render_txt(source, stream=sys.stderr)
else:
raise ValueError(f"invalid README format: {content_format} (expected `md`, "
"`rst`, or `txt`)")
if rendered is None:
> sys.exit(1)
E SystemExit: 1
readme_renderer/__main__.py:57: SystemExit
------------------------------------------------------------------------ Captured stderr call -------------------------------------------------------------------------
No content rendered from RST source.
_______________________________________________________________ test_rst_fixtures[test_rst_tables.rst] ________________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n
\n
\n
\n
\n
\n
\n\n
\n\n
Header row, column 1\n(header ro
E >
Header row, column 1\n(header rows optional)
\ ws optional)\n
Header 2
\n
Header 2
\n
Header 3
Header 3
\n
Header 4
\n
\n\n
Header 4
\n\n\n
\n
\n\n
body row 1, column 1
\n
column 2
E d>
body row 1, column 1
\n
column 2
\n
column p>
\n
column 3
\n
column 4
\n
\n
\n
column 4
\n
\n
body row 2
body row 2
\n
Cells may span columns.
\n
Cells may span columns.
\n
\n
b >\n
\n
body row 3
\n
Cells may\nspa
E ody row 3
\n
Cells may\nspan rows.
\n
\n
\n
T
E colspan="2" rowspan="2">
\n
Table cells
\n< able cells
\n
contain
\n
body elements.
contain
\n
body elements.
\n
\n
\n
>\n\n\n\n
body row 4
\n
\n\n
E \n
body row 4
\n
\n
\n
\n
\n\n
\n\n
title1
\n
\n
\n
\n\n\n
title1 s="head">
title2
\n
\n\n
\n
col1
<
E p>\n
title2
\n
\n\n\n
\n
col2
\n
\n
mutirow
\
E >
col1
\n
col2
\n
\n
n
cell1
\n
\n
cell2
\n
\n
\n
cell1
\n
\n
cell2
\n >singlerow\n
cell3
\n
\n\n
\n'
E \n
singlerow
\n
cell3
\n
\n\n
\n'
tests/test_rst.py:28: AssertionError
______________________________________________________________ test_rst_fixtures[test_rst_contents.rst] _______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_contents.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_contents.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n\n'
tests/test_rst.py:28: AssertionError
_______________________________________________________________ test_rst_fixtures[test_rst_docinfo.rst] _______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_docinfo.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_docinfo.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n
Project
\n
\n
Project
pg_query – Pythonic wrapper around libpg_query
\n\n
:
\n
pg_query – Pythonic wrapper around
E class="created">Created\n
\n\n'
tests/test_rst.py:28: AssertionError
_______________________________________________________________ test_rst_fixtures[test_rst_linkify.rst] _______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_linkify.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_linkify.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '\n\n\n
It requires a spatial databases compatibl in the database at once.
\n
It requires a spatial databases compatibl
E e with GeoDjango. GeoDjango. PostgreSQL 9.x\nand PostgreSQL 9.x\nand PostGIS 2.x are recommended for development and production, si ofollow">PostGIS 2.x are recommended for development and production, si
E nce these\nsupport all the GeoDjango features.
\n
\n\n
E ="status">\n
Status
\n
multigtfs is ready for your GTFS project.
Status
\n
multigtfs is ready for your GTFS project.
\n
Point
E p>\n
Point releases (0.4.1 to 0.4.2) should be safe, only adding features releases (0.4.1 to 0.4.2) should be safe, only adding features or fixing\n
E or fixing\nbugs. Minor updates (0.3.3 to 0.4.0) may include significant c bugs. Minor updates (0.3.3 to 0.4.0) may include significant changes that
E hanges that will\nbreak relying code. In the worst case scenario, you may will\nbreak relying code. In the worst case scenario, you may need to expo
E need to export your\nGTFS feeds in the original version, update multigtfs a rt your\nGTFS feeds in the original version, update multigtfs and your code
E nd your code, and\nre-import.
\n
multigtfs works with Django 1.5 throu , and\nre-import.
\n
multigtfs works with Django 1.5 through 1.9. In t
E gh 1.9. In the next version, support\nwill be limited to Django’s supported he next version, support\nwill be limited to Django’s supported releases, s
E releases, so if you are using an old\nversion you will want to update to a o if you are using an old\nversion you will want to update to at least 1.8,
E t least 1.8, the long-term support (LTS)\nrelease.
\n
All valid GTFS f the long-term support (LTS)\nrelease.
\n
All valid GTFS feeds are sup
E eeds are supported for import and export. This includes\nfeeds with extra ported for import and export. This includes\nfeeds with extra columns not
E columns not yet included in the GTFS spec, and feeds that\nomit calendar.txt in favor of calendar.txt in favor of cale
E iteral">calendar_dates.txt (such as the TriMet\narchive feeds). If ndar_dates.txt (such as the TriMet\narchive feeds). If you find a f
E you find a feed that doesn’t work, file a bug!
\n
See the < i-gtfs/issues" rel="nofollow">file a bug!
\n
See the issues list for more details on bugs and feature reque low">issues list for more details on bugs and feature requests.
\n\n\n'
tests/test_rst.py:28: AssertionError
_______________________________________________________________ test_rst_fixtures[test_rst_bibtex.rst] ________________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_bibtex.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_bibtex.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
@article{@article{the_impact_of_pygments_docutils_config_and_html5the_impact_of_pygments_docutils_config_and_html5,\n year,\n year=={2
E class="s">{2022},
\n' 022},\n'
tests/test_rst.py:28: AssertionError
_______________________________________________________________ test_rst_fixtures[test_rst_caption.rst] _______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_caption.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_caption.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n
Multiplication
\n
\n
\n
\n
\n
Multiplication
\n
\n
E >\n
\n
\n\n\n
1
\n
1
\n
2
\n
3
2
\n
3
\n
4
\n
5
\n
\n
E head">
4
\n
5
\n\n\n\n\n
1
\n
2
\n
3
E y>\n
1
\n
2
\n
3
\n
4 td>\n
4
\n
5
\n
\n
2
\n\n
5
\n
\n
2
\n
4
d>
4
\n
6
\n
8
\n
10
\n
E \n
6
\n
8
\n
10
\n
\n
\n
3
\n
6
\n
9
\n
E
3
\n
6
\n
9
\n
12
\n\n
15
\n
\n
4
\n
8
E d>
15
\n
\n
4
\n
8
\n
1
\n
12
\n
16
\n
20
\n
\n<
E 2\n
16
\n
20
\n\n
5
tr>
5
\n
10
\n
15
\n
20
E
\n
10
\n
15
\n
20
\n
2
\n
25
\n
\n\n
\n'
E 5\n\n\n\n'
tests/test_rst.py:28: AssertionError
_______________________________________________________________ test_rst_fixtures[test_rst_figure.rst] ________________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_figure.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_figure.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n\n\n
This is the caption for the figure
\n\n\n
This is the caption for the figure
\n\n' on>\n\n'
tests/test_rst.py:28: AssertionError
______________________________________________________________ test_rst_fixtures[test_rst_citations.rst] ______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_citations.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_citations.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n'
tests/test_rst.py:28: AssertionError
_____________________________________________________________ test_rst_fixtures[test_rst_admonitions.rst] _____________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_admonitions.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_admonitions.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n
!DANGER!
\ '
\n
\n
\n
Note
\n
F Sharp is a note, right?
\n
\n
Note\n
F Sharp is a note, right?
\n\n
E ss="admonition admonition-see-also">\n
See also<
\n' low">docutils\n\n'
tests/test_rst.py:28: AssertionError
_________________________________________________________________ test_rst_fixtures[test_rst_003.rst] _________________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_003.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_003.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
\n
Required packages
\n '\n
Required packages
\n
To run th
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\n
\n\n\n
\n
Quick developmen ion id="quick-development-setup">\n
Quick development setup
\n
Mak
E t setup\n
Make sure you are sitting
\n
\n' e sure you are sitting\n\n'
tests/test_rst.py:28: AssertionError
_________________________________________________________________ test_rst_fixtures[test_rst_008.rst] _________________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_008.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_008.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E None '
Here is some Python code for a Dog:
\n
classDog
E (Animal):\ndef__init__(self,name):\nself.
E span>name=n
E ame\n\ndefmake_sound(self):\nprint(\'Ruff!\')\n\ndog
E =Dog(\'Fido\')
\n
E and then here is some bash:
\n
if["$1"=<
E span class="s2">"--help"];then\n echo"OK"\
E nfi
\n'
tests/test_rst.py:28: AssertionError
______________________________________________________________ test_rst_fixtures[test_rst_footnotes.rst] ______________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_footnotes.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_footnotes.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert equals failed
E '
We use tox as our test runner, which creates an isolated test environment.
I can see from the output shown that there are unexpected plugins in that test environment that could be changing the behavior in unexpected ways.
Here's what it looks like on macOS running 3.10 for the 41.0 release:
Mainly, note the difference in the plugins list at the top of the test run. In isolation, we should only see cov-4.1.0 but your run has a lot more than that, so I really cannot account for what's failing in your environment.
Considering that nh3 also produces packaged wheels, I don't understand why you would need rust, unless you're not actually executing this in a macOS context, rather some other system isolation that isn't a platform that nh3 builds binaries for - but none of that is clear from your report.
Thanks for following up. I removed all plugins except pytest-cov and made sure to update pytest-cov and pluggy to match what your tox is installing. I even updated my python to the latest upstream. I also installed the optional dep cmarkgfm to make sure all tests were being excersised.
tests output w/out plugins
```
/sw/bin/py.test-3.10 --strict-markers --cov || exit 2
===================================================================== test session starts ======================================================================
platform darwin -- Python 3.10.13, pytest-7.4.4, pluggy-1.4.0
rootdir: /sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0
plugins: cov-4.1.0
collected 91 items
tests/test_clean.py . [ 1%]
tests/test_cli.py ..FF......F...F [ 17%]
tests/test_markdown.py F....F.....................F....F........... [ 65%]
tests/test_noextra.py ss [ 68%]
tests/test_rst.py FFFF..FF..FFF..F.F.F........ [ 98%]
tests/test_txt.py . [100%]
=========================================================================== FAILURES ===========================================================================
_________________________________________________________ test_cli_input_file[test_rst_003.rst-False] __________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = False
@pytest.mark.parametrize("output_file", [False, True])
def test_cli_input_file(input_file, output_file):
with mock.patch("builtins.print") as print_:
if output_file:
with tempfile.TemporaryDirectory() as tmpdir:
output = pathlib.Path(tmpdir) / "output.html"
main(["-o", str(output), str(input_file)])
with output.open() as fp:
result = fp.read()
else:
main([str(input_file)])
print_.assert_called_once()
(result,), kwargs = print_.call_args
with input_file.with_suffix(".html").open() as fp:
expected = fp.read()
> assert result.strip() == expected.strip()
E assert '
E +
E ? +++++++++++ +
E
Required packages
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
E -
E +
...
E
E ...Full output truncated (7 lines hidden), use '-vv' to show
tests/test_cli.py:35: AssertionError
__________________________________________________________ test_cli_input_file[test_rst_003.rst-True] __________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = True
@pytest.mark.parametrize("output_file", [False, True])
def test_cli_input_file(input_file, output_file):
with mock.patch("builtins.print") as print_:
if output_file:
with tempfile.TemporaryDirectory() as tmpdir:
output = pathlib.Path(tmpdir) / "output.html"
main(["-o", str(output), str(input_file)])
with output.open() as fp:
result = fp.read()
else:
main([str(input_file)])
print_.assert_called_once()
(result,), kwargs = print_.call_args
with input_file.with_suffix(".html").open() as fp:
expected = fp.read()
> assert result.strip() == expected.strip()
E assert '
E +
E ? +++++++++++ +
E
Required packages
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
E -
E +
...
E
E ...Full output truncated (7 lines hidden), use '-vv' to show
tests/test_cli.py:35: AssertionError
__________________________________________________________ test_cli_explicit_format[test_rst_003.rst] __________________________________________________________
input_file = PosixPath('tests/fixtures/test_rst_003.rst')
def test_cli_explicit_format(input_file):
fmt = input_file.suffix.lstrip(".")
with input_file.open() as fp, \
mock.patch("pathlib.Path.open", return_value=fp), \
mock.patch("builtins.print") as print_:
main(["-f", fmt, "no-file.invalid"])
print_.assert_called_once()
(result,), _ = print_.call_args
with input_file.with_suffix(".html").open() as fp:
> assert result.strip() == fp.read().strip()
E assert '
E +
E ? +++++++++++ +
E
Required packages
E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
E -
E +
...
E
E ...Full output truncated (7 lines hidden), use '-vv' to show
tests/test_cli.py:57: AssertionError
_____________________________________ test_cli_package[docutils-Docutils is a modular system for processing documentation] _____________________________________
package = 'docutils', contains = 'Docutils is a modular system for processing documentation'
@pytest.mark.parametrize("package, contains", [
("readme_renderer", "Readme Renderer is a library that will safely render"),
("docutils", "Docutils is a modular system for processing documentation"),
])
def test_cli_package(package, contains):
with mock.patch("builtins.print") as print_:
> main(["-p", package])
tests/test_cli.py:66:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cli_args = ['-p', 'docutils']
def main(cli_args: Optional[List[str]] = None) -> None:
parser = argparse.ArgumentParser(
description="Renders a .md, .rst, or .txt README to HTML",
)
parser.add_argument("-p", "--package", help="Get README from package metadata",
action="store_true")
parser.add_argument("-f", "--format", choices=["md", "rst", "txt"],
help="README format (inferred from input file name or package)")
parser.add_argument('input', help="Input README file or package name")
parser.add_argument('-o', '--output', help="Output file (default: stdout)",
type=argparse.FileType('w'), default='-')
args = parser.parse_args(cli_args)
content_format = args.format
if args.package:
message = metadata(args.input)
source = message.get_payload() # type: ignore[attr-defined] # noqa: E501 https://peps.python.org/pep-0566/
# Infer the format of the description from package metadata.
if not content_format:
content_type = message.get("Description-Content-Type", "text/x-rst") # type: ignore[attr-defined] # noqa: E501 https://github.com/python/typeshed/issues/10021
if content_type == "text/x-rst":
content_format = "rst"
elif content_type == "text/markdown":
content_format = "md"
elif content_type == "text/plain":
content_format = "txt"
else:
raise ValueError(f"invalid content type {content_type} for package "
"`long_description`")
else:
filename = pathlib.Path(args.input)
content_format = content_format or filename.suffix.lstrip(".")
with filename.open() as fp:
source = fp.read()
if content_format == "md":
rendered = render_md(source, stream=sys.stderr)
elif content_format == "rst":
rendered = render_rst(source, stream=sys.stderr)
elif content_format == "txt":
rendered = render_txt(source, stream=sys.stderr)
else:
raise ValueError(f"invalid README format: {content_format} (expected `md`, "
"`rst`, or `txt`)")
if rendered is None:
> sys.exit(1)
E SystemExit: 1
readme_renderer/__main__.py:57: SystemExit
--------------------------------------------------------------------- Captured stderr call ---------------------------------------------------------------------
No content rendered from RST source.
__________________________________________________________ test_md_fixtures[test_GFM_doublequotes.md] __________________________________________________________
md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_doublequotes.md')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_doublequotes.html'), variant = 'GFM'
@pytest.mark.parametrize(
("md_filename", "html_filename", "variant"),
[
(pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name))
for variant in variants
for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md")
],
)
def test_md_fixtures(md_filename, html_filename, variant):
# Get our Markup
with open(md_filename, encoding='utf-8') as f:
md_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
> assert render(md_markup, variant=variant) == expected
E assert '
This is n...an>\n\n' == '
This is n...an>\n\n'
E Skipping 174 identical leading characters in diff, use -v to show
E ):
E - """This is a docstring."""
E ? ---------------------------
E + """This is a docstring."""
E ? ++++
E pass...
E
E ...Full output truncated (11 lines hidden), use '-vv' to show
tests/test_markdown.py:25: AssertionError
_________________________________________________________ test_md_fixtures[test_GFM_malicious_pre.md] __________________________________________________________
md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_malicious_pre.md')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_malicious_pre.html'), variant = 'GFM'
@pytest.mark.parametrize(
("md_filename", "html_filename", "variant"),
[
(pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name))
for variant in variants
for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md")
],
)
def test_md_fixtures(md_filename, html_filename, variant):
# Get our Markup
with open(md_filename, encoding='utf-8') as f:
md_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
> assert render(md_markup, variant=variant) == expected
E assert '
This is n...an>\n\n' == '
This is n...an>\n\n'
E Skipping 130 identical leading characters in diff, use -v to show
E ):
E - """This is a docstring."""
E ? ---------------------------
E + """This is a docstring."""
E ? ++++
E pass...
E
E ...Full output truncated (2 lines hidden), use '-vv' to show
tests/test_markdown.py:25: AssertionError
___________________________________________________________ test_md_fixtures[test_GFM_highlight.md] ____________________________________________________________
md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_highlight.md')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_highlight.html'), variant = 'GFM'
@pytest.mark.parametrize(
("md_filename", "html_filename", "variant"),
[
(pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name))
for variant in variants
for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md")
],
)
def test_md_fixtures(md_filename, html_filename, variant):
# Get our Markup
with open(md_filename, encoding='utf-8') as f:
md_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
> assert render(md_markup, variant=variant) == expected
E assert '
This is n...ock\n\n' == '
This is n...ock\n\n'
E Skipping 338 identical leading characters in diff, use -v to show
E - (){
E + (){
E + return
E - return
E ? ^ ^^^^ ^ ------
E + }...
E
E ...Full output truncated (5 lines hidden), use '-vv' to show
tests/test_markdown.py:25: AssertionError
___________________________________________________________ test_md_fixtures[test_CommonMark_008.md] ___________________________________________________________
md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_CommonMark_008.md')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_CommonMark_008.html'), variant = 'CommonMark'
@pytest.mark.parametrize(
("md_filename", "html_filename", "variant"),
[
(pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name))
for variant in variants
for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md")
],
)
def test_md_fixtures(md_filename, html_filename, variant):
# Get our Markup
with open(md_filename, encoding='utf-8') as f:
md_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
> assert render(md_markup, variant=variant) == expected
E assert '
Here is s...key
\n' == '
Here is s...key
\n'
E Skipping 1054 identical leading characters in diff, use -v to show
E - >if["$1"="--help"];then
E - echo"...
E
E ...Full output truncated (6 lines hidden), use '-vv' to show
tests/test_markdown.py:25: AssertionError
____________________________________________________________ test_rst_fixtures[test_rst_tables.rst] ____________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E AssertionError: assert '
\n\n
\n' == '
\n\n
\n'
E
E +
E +
E +
E +
E +
E +
...
E
E ...Full output truncated (55 lines hidden), use '-vv' to show
tests/test_rst.py:28: AssertionError
___________________________________________________________ test_rst_fixtures[test_rst_contents.rst] ___________________________________________________________
rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_contents.rst')
html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_contents.html')
@pytest.mark.parametrize(
("rst_filename", "html_filename"),
[
(pytest.param(fn, fn.with_suffix(".html"), id=fn.name))
for fn in Path(__file__).parent.glob("fixtures/test_*.rst")
],
)
def test_rst_fixtures(rst_filename, html_filename):
# Get our Markup
with open(rst_filename, encoding='utf-8') as f:
rst_markup = f.read()
# Get our expected
with open(html_filename, encoding="utf-8") as f:
expected = f.read()
out = render(rst_markup)
if "<" in expected:
> assert out == expected
E assert '
This actually led me to make a minimal install with no other python mods installed. I then ran tox -e py310 outside our build system (all tests passed) and saved the .tox directory. I then ran the tests manually using the .tox directory with PYTHONPATH and the tests passed. So the problem is not about not running through tox itself, but something else missing. Comparing the system-site-packages and tox-site-packages the biggest differences are pygments and docutils, even though both of my local installs of those pass the required version minimums in setup.py. I'll need to start digging into matching install versions as much as possible to see if that does it.
This is macOS with python3.10. Unfortunately, it's for readme-renderer-v41 because I can't update to 42 which needs nh3, which needs rust, which I don't have.
Test results
``` _____________________________________________________________ test_cli_input_file[test_rst_003.rst-False] _____________________________________________________________ input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = False @pytest.mark.parametrize("output_file", [False, True]) def test_cli_input_file(input_file, output_file): with mock.patch("builtins.print") as print_: if output_file: with tempfile.TemporaryDirectory() as tmpdir: output = pathlib.Path(tmpdir) / "output.html" main(["-o", str(output), str(input_file)]) with output.open() as fp: result = fp.read() else: main([str(input_file)]) print_.assert_called_once() (result,), kwargs = print_.call_args with input_file.with_suffix(".html").open() as fp: expected = fp.read() > assert result.strip() == expected.strip() E assert equals failed E 'Required packages
\n 'Required packages
\nTo run th E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\nQuick developmen ion id="quick-development-setup">\n
Quick development setup
\nMak E t setup\n
Make sure you are sitting
\nRequired packages
\n 'Required packages
\nTo run th E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\nQuick developmen ion id="quick-development-setup">\n
Quick development setup
\nMak E t setup\n
Make sure you are sitting
\nRequired packages
\n 'Required packages
\nTo run th E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\nQuick developmen ion id="quick-development-setup">\n
Quick development setup
\nMak E t setup\n
Make sure you are sitting
\nHeader row, column 1\n(header ro E >
Header row, column 1\n(header rows optional)
Header 2
Header 2
Header 3
Header 3
Header 4
Header 4
body row 1, column 1
column 2 E d>
body row 1, column 1
column 2
column p>
column 3
column 4
column 4
body row 2
body row 2
\nCells may span columns.
Cells may span columns.
b >\n
body row 3
Cells may\nspa E ody row 3
Cells may\nspan rows.
\n \n \n \n
\nT E colspan="2" rowspan="2">
\n \n< able cells
Table cells
contain
body elements.
contain
\nbody elements.
body row 4
body row 4
title1
title1 s="head">
title2
col1
< E p>\ntitle2
col2
mutirow
col1
col2
n
cell1
cell2
cell1
cell2
cell3
singlerow
cell3
C '
\n\n
\n\n \n \n \n
Features
Features
Installation
Features
\n\n
Features
\n\n \n
\nEats cheese
Eats cheese
Installation\n
Installation
\nRequirements
\n\n \n \n
\ E nRequirements
\n\n \n \n
\ class="simple">\nTeeth
Good taste
Teeth
Good taste
Let’s eat some cheese together!
\nLet’s eat some cheese together!
\n\n' tests/test_rst.py:28: AssertionError _______________________________________________________________ test_rst_fixtures[test_rst_docinfo.rst] _______________________________________________________________ rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_docinfo.rst') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_docinfo.html') @pytest.mark.parametrize( ("rst_filename", "html_filename"), [ (pytest.param(fn, fn.with_suffix(".html"), id=fn.name)) for fn in Path(__file__).parent.glob("fixtures/test_*.rst") ], ) def test_rst_fixtures(rst_filename, html_filename): # Get our Markup with open(rst_filename, encoding='utf-8') as f: rst_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() out = render(rst_markup) if "<" in expected: > assert out == expected E assert equals failed E '\n- Project
\n- \n
- Project
- :
\n \n- Created:\n\n
- Author
\n \n \
E ele Gaifax <lele n- Author:
\n \n\n- Copyright
\n- \n
- License:
\n- © 2017, 2018 Lele Gaifax
\n
\npg_query – Pythonic wrapper around libpg_query
\n\npg_query – Pythonic wrapper around E class="created">Created\n
mer 02 ago 2017 14:49: libpg_query
\nL pan>
mer 02 ago 2017 14:49:24 CEST
\nLele Gaifax <License\n >
GNU General Public Licen ;it">lele@metapensiero.it
GNU General Public License version 3 or later
\n\npg_query
\npg_query
\nmultigtfs is an \n
multigtfs is an Apache 2.0-licensed Django app tha com/licenses/apache/" rel="nofollow">Apache 2.0-licensed Django app tha E t supports importing\nand exporting of GTFS feeds. All features of the href="https://developers.google.com/transit/gtfs/reference" rel="nofollow"> E June 20, 2012 reference\nare supported, including all lopers.google.com/transit/gtfs/changes#RevisionHistory" rel="nofollow">all E changes up to February 17, 2014.\nIt allows multiple feeds to be stored changes up to February 17, 2014.\nIt allows multiple feeds to be stored E in the database at once.
\nIt requires a spatial databases compatibl in the database at once.
\nIt requires a spatial databases compatibl E e with GeoDjango. GeoDjango. PostgreSQL 9.x\nand PostgreSQL 9.x\nand PostGIS 2.x are recommended for development and production, si ofollow">PostGIS 2.x are recommended for development and production, si E nce these\nsupport all the GeoDjango features.
\nStatus
\nmultigtfs is ready for your GTFS project.
Status
\nmultigtfs is ready for your GTFS project.
\nPoint E p>\n
Point releases (0.4.1 to 0.4.2) should be safe, only adding features releases (0.4.1 to 0.4.2) should be safe, only adding features or fixing\n E or fixing\nbugs. Minor updates (0.3.3 to 0.4.0) may include significant c bugs. Minor updates (0.3.3 to 0.4.0) may include significant changes that E hanges that will\nbreak relying code. In the worst case scenario, you may will\nbreak relying code. In the worst case scenario, you may need to expo E need to export your\nGTFS feeds in the original version, update multigtfs a rt your\nGTFS feeds in the original version, update multigtfs and your code E nd your code, and\nre-import.
\nmultigtfs works with Django 1.5 throu , and\nre-import.
\nmultigtfs works with Django 1.5 through 1.9. In t E gh 1.9. In the next version, support\nwill be limited to Django’s supported he next version, support\nwill be limited to Django’s supported releases, s E releases, so if you are using an old\nversion you will want to update to a o if you are using an old\nversion you will want to update to at least 1.8, E t least 1.8, the long-term support (LTS)\nrelease.
\nAll valid GTFS f the long-term support (LTS)\nrelease.
\nAll valid GTFS feeds are sup E eeds are supported for import and export. This includes\nfeeds with extra ported for import and export. This includes\nfeeds with extra columns not E columns not yet included in the GTFS spec, and feeds that\nomit calendar.txt in favor of calendar.txt in favor of cale E iteral">calendar_dates.txt (such as the TriMet\narchive feeds). If ndar_dates.txt (such as the TriMet\narchive feeds). If you find a f E you find a feed that doesn’t work, file a bug!
\nSee the < i-gtfs/issues" rel="nofollow">file a bug!
\nSee the issues list for more details on bugs and feature reque low">issues list for more details on bugs and feature requests.
\n E sts.\nExample p section>\n\n
\nExample project
\nChec E roject
Check out the example proje E ollow">example project.
\nDevelopment
\n E nt">\nDevelopment
\n\n- Code
\n
\n- Code:
\n
E \nhttps://github.com/tulsawebdevs/django-multi-gtfs\n\nIssues\n \n
\nhttps://github.com/tulsawebdevs/django-multi-gtfs
\n:\n \n- Dev Docs
\n \n- IRC
E
\nhttps://github.com/tulsawebdevs/django-multi-g om/tulsawebdevs/django-multi-gtfs/issues" rel="nofollow">https://github.com E tfs/issues
\nhttp://multigtfs.readthedocs.org/< ass="colon">:\n
http://multigtfs.readthedocs.org/
\nirc://irc.freenode.net/tulsawe E bdevs
\n1
1
\n2
3
2
3
4
5
4
\n5
1
2
3
E y>\n1
2
3
4 td>\n
4
5
2
5
2
4
4
\n6
8
10
6
8
10
3
6
9
E
3
6
9
12
15
4
8
E d>15
4
8
1
12
16
20
16
20
5
tr>5
10
15
20
E10
15
20
2
25
This is the caption for the figure
\n\nThis is the caption for the figure
\n\n' on>\n\n' tests/test_rst.py:28: AssertionError ______________________________________________________________ test_rst_fixtures[test_rst_citations.rst] ______________________________________________________________ rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_citations.rst') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_citations.html') @pytest.mark.parametrize( ("rst_filename", "html_filename"), [ (pytest.param(fn, fn.with_suffix(".html"), id=fn.name)) for fn in Path(__file__).parent.glob("fixtures/test_*.rst") ], ) def test_rst_fixtures(rst_filename, html_filename): # Get our Markup with open(rst_filename, encoding='utf-8') as f: rst_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() out = render(rst_markup) if "<" in expected: > assert out == expected E assert equals failed E 'Citation references, like [C '
\nCitation references, like .\nNote that citations may get\nrearranged, e.g., to the bottom rel="nofollow">[CIT2002].\nNote that citations may get\nrearranged, e.g E of\nthe “page”.
\n\n- ., to the bottom of\nthe “page”.
A citation\n(as often used in journals).
\nCi
CIT2002]\nA citation\n(as often used in journals). E ase is not significant.
\nGiven a citation like [this], one\ncan also refer to it like this.
\n\n- [this],
E d="this">thisthis.
E n>
\n \n
\n' \nhere.
\nhere. E p>\n
!DANGER!
\ '\n
Note
\nF Sharp is a note, right?
\nF Sharp is a note, right?
\n\n E ss="admonition admonition-see-also">\nSee also<
Required packages
\n 'Required packages
\nTo run th E
To run the PyPI software, you need Python 2.5+ and PostgreSQL
\nQuick developmen ion id="quick-development-setup">\n
Quick development setup
\nMak E t setup\n
Make sure you are sitting
\nHere is some Python code for a Dog:
\n \nE and then here is some bash:
\n \nor click SurveyMonkey
\n \n' tests/test_rst.py:28: AssertionError ______________________________________________________________ test_rst_fixtures[test_rst_footnotes.rst] ______________________________________________________________ rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_footnotes.rst') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_footnotes.html') @pytest.mark.parametrize( ("rst_filename", "html_filename"), [ (pytest.param(fn, fn.with_suffix(".html"), id=fn.name)) for fn in Path(__file__).parent.glob("fixtures/test_*.rst") ], ) def test_rst_fixtures(rst_filename, html_filename): # Get our Markup with open(rst_filename, encoding='utf-8') as f: rst_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() out = render(rst_markup) if "<" in expected: > assert out == expected E assert equals failed E 'Footnote references, like 5. '
Footnote references, like [5\n] .\nNote that footnotes may get\nrearranged, e.g., to the bott
E lass="brackets">5\n
A n om of\nthe “page”.
\nAutonumbered footnotes are\npossibl -bracket">[51 and ]\n
A numerical footnote. Note\nthere’s E 6" id="id4" rel="nofollow">2.
\n\n- ].\n\
E class="label" id="id5">\n
\n \n
\nAutonumbered footnotes are\npossible, like using 2[1] and
This is the second one.
\nThey may be d="footnote-reference-3" rel="nofollow">[2< E assigned ‘autonumber\nlabels’ - for instance,\n].
\na.k.a. ofollow">1]
This is the firs E third
\n\n4< pan class="label">[fourth\n\ ence-3" rel="nofollow">2]\nTh E n\n
Auto-symbol footnotes are also\npossible, like this: * and †.
\n\n- [4*
\n< ">] and [3].<
E class="brackets">†\n\n\n
E [*]\n \n\n[†<
E span class="fn-bracket">]\n \n'
tests/test_rst.py:28: AssertionError
========================================================================== warnings summary ===========================================================================
readme_renderer/markdown.py:44
/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/readme_renderer/markdown.py:44: UserWarning: Markdown renderers are not available. Install 'readme_renderer[md]' to enable Markdown rendering.
warnings.warn(_EXTRA_WARNING)
tests/test_cli.py: 10 warnings
tests/test_rst.py: 48 warnings
/sw/lib/python3.10/site-packages/docutils/io.py:245: DeprecationWarning: 'U' mode is deprecated
self.source = open(source_path, mode, **kwargs)
tests/test_markdown.py::test_missing_variant
/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/readme_renderer/markdown.py:60: UserWarning: Markdown renderers are not available. Install 'readme_renderer[md]' to enable Markdown rendering.
warnings.warn(_EXTRA_WARNING)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
======================================================================= short test summary info =======================================================================
FAILED tests/test_cli.py::test_cli_input_file[test_rst_003.rst-False] - assert equals failed
FAILED tests/test_cli.py::test_cli_input_file[test_rst_003.rst-True] - assert equals failed
FAILED tests/test_cli.py::test_cli_explicit_format[test_rst_003.rst] - assert equals failed
FAILED tests/test_cli.py::test_cli_package[docutils-Docutils is a modular system for processing documentation] - SystemExit: 1
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_tables.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_contents.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_docinfo.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_linkify.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_bibtex.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_caption.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_figure.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_citations.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_admonitions.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_003.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_008.rst] - assert equals failed
FAILED tests/test_rst.py::test_rst_fixtures[test_rst_footnotes.rst] - assert equals failed
======================================================== 16 failed, 26 passed, 7 skipped, 60 warnings in 2.18s ========================================================
```
T /p>\n\n\n[3]\n\n[ 4] \n \n \n
a.k.a. third
\n\na.k.a. fourth
\nAuto-symbol footnot E es are also\npossible, like this: [*] and [†].
\nThis is the first one.
\nThis is the second one.
\n E aside>\nWe use
tox
as our test runner, which creates an isolated test environment. I can see from the output shown that there are unexpected plugins in that test environment that could be changing the behavior in unexpected ways.Here's what it looks like on macOS running 3.10 for the 41.0 release:
Mainly, note the difference in the
plugins
list at the top of the test run. In isolation, we should only seecov-4.1.0
but your run has a lot more than that, so I really cannot account for what's failing in your environment.Considering that
nh3
also produces packaged wheels, I don't understand why you would need rust, unless you're not actually executing this in a macOS context, rather some other system isolation that isn't a platform that nh3 builds binaries for - but none of that is clear from your report.Thanks for following up. I removed all plugins except pytest-cov and made sure to update pytest-cov and pluggy to match what your tox is installing. I even updated my python to the latest upstream. I also installed the optional dep cmarkgfm to make sure all tests were being excersised.
tests output w/out plugins
``` /sw/bin/py.test-3.10 --strict-markers --cov || exit 2 ===================================================================== test session starts ====================================================================== platform darwin -- Python 3.10.13, pytest-7.4.4, pluggy-1.4.0 rootdir: /sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0 plugins: cov-4.1.0 collected 91 items tests/test_clean.py . [ 1%] tests/test_cli.py ..FF......F...F [ 17%] tests/test_markdown.py F....F.....................F....F........... [ 65%] tests/test_noextra.py ss [ 68%] tests/test_rst.py FFFF..FF..FFF..F.F.F........ [ 98%] tests/test_txt.py . [100%] =========================================================================== FAILURES =========================================================================== _________________________________________________________ test_cli_input_file[test_rst_003.rst-False] __________________________________________________________ input_file = PosixPath('tests/fixtures/test_rst_003.rst'), output_file = False @pytest.mark.parametrize("output_file", [False, True]) def test_cli_input_file(input_file, output_file): with mock.patch("builtins.print") as print_: if output_file: with tempfile.TemporaryDirectory() as tmpdir: output = pathlib.Path(tmpdir) / "output.html" main(["-o", str(output), str(input_file)]) with output.open() as fp: result = fp.read() else: main([str(input_file)]) print_.assert_called_once() (result,), kwargs = print_.call_args with input_file.with_suffix(".html").open() as fp: expected = fp.read() > assert result.strip() == expected.strip() E assert 'Required packages
ETo run the PyPI software, you need Python 2.5+ and PostgreSQL
E - E +Required packages
ETo run the PyPI software, you need Python 2.5+ and PostgreSQL
E - E +Required packages
ETo run the PyPI software, you need Python 2.5+ and PostgreSQL
E - E +This is n...an>\n\n' == '
This is n...an>\n\n' E Skipping 174 identical leading characters in diff, use -v to show E ): E - """This is a docstring.""" E ? --------------------------- E + """This is a docstring.""" E ? ++++ E pass... E E ...Full output truncated (11 lines hidden), use '-vv' to show tests/test_markdown.py:25: AssertionError _________________________________________________________ test_md_fixtures[test_GFM_malicious_pre.md] __________________________________________________________ md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_malicious_pre.md') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_malicious_pre.html'), variant = 'GFM' @pytest.mark.parametrize( ("md_filename", "html_filename", "variant"), [ (pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name)) for variant in variants for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md") ], ) def test_md_fixtures(md_filename, html_filename, variant): # Get our Markup with open(md_filename, encoding='utf-8') as f: md_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() > assert render(md_markup, variant=variant) == expected E assert '
This is n...an>\n\n' == '
This is n...an>\n\n' E Skipping 130 identical leading characters in diff, use -v to show E ): E - """This is a docstring.""" E ? --------------------------- E + """This is a docstring.""" E ? ++++ E pass... E E ...Full output truncated (2 lines hidden), use '-vv' to show tests/test_markdown.py:25: AssertionError ___________________________________________________________ test_md_fixtures[test_GFM_highlight.md] ____________________________________________________________ md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_highlight.md') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_GFM_highlight.html'), variant = 'GFM' @pytest.mark.parametrize( ("md_filename", "html_filename", "variant"), [ (pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name)) for variant in variants for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md") ], ) def test_md_fixtures(md_filename, html_filename, variant): # Get our Markup with open(md_filename, encoding='utf-8') as f: md_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() > assert render(md_markup, variant=variant) == expected E assert '
This is n...ock\n\n' == '
This is n...ock\n\n' E Skipping 338 identical leading characters in diff, use -v to show E - (){ E + (){ E + return E - return E ? ^ ^^^^ ^ ------ E + }... E E ...Full output truncated (5 lines hidden), use '-vv' to show tests/test_markdown.py:25: AssertionError ___________________________________________________________ test_md_fixtures[test_CommonMark_008.md] ___________________________________________________________ md_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_CommonMark_008.md') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_CommonMark_008.html'), variant = 'CommonMark' @pytest.mark.parametrize( ("md_filename", "html_filename", "variant"), [ (pytest.param(fn, fn.with_suffix(".html"), variant, id=fn.name)) for variant in variants for fn in Path(__file__).parent.glob(f"fixtures/test_{variant}*.md") ], ) def test_md_fixtures(md_filename, html_filename, variant): # Get our Markup with open(md_filename, encoding='utf-8') as f: md_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() > assert render(md_markup, variant=variant) == expected E assert '
Here is s...key
\n' == 'Here is s...key
\n' E Skipping 1054 identical leading characters in diff, use -v to show E - >if [ "$1" = "--help" ]; then E - echo "... E E ...Full output truncated (6 lines hidden), use '-vv' to show tests/test_markdown.py:25: AssertionError ____________________________________________________________ test_rst_fixtures[test_rst_tables.rst] ____________________________________________________________ rst_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.rst') html_filename = PosixPath('/sw/build.build/readme-renderer-py310-41.0-1/readme_renderer-41.0/tests/fixtures/test_rst_tables.html') @pytest.mark.parametrize( ("rst_filename", "html_filename"), [ (pytest.param(fn, fn.with_suffix(".html"), id=fn.name)) for fn in Path(__file__).parent.glob("fixtures/test_*.rst") ], ) def test_rst_fixtures(rst_filename, html_filename): # Get our Markup with open(rst_filename, encoding='utf-8') as f: rst_markup = f.read() # Get our expected with open(html_filename, encoding="utf-8") as f: expected = f.read() out = render(rst_markup) if "<" in expected: > assert out == expected E AssertionError: assert 'This actually led me to make a minimal install with no other python mods installed. I then ran
tox -e py310
outside our build system (all tests passed) and saved the.tox
directory. I then ran the tests manually using the .tox directory with PYTHONPATH and the tests passed. So the problem is not about not running through tox itself, but something else missing. Comparing the system-site-packages and tox-site-packages the biggest differences are pygments and docutils, even though both of my local installs of those pass the required version minimums in setup.py. I'll need to start digging into matching install versions as much as possible to see if that does it.