Skip to content

bug: Test failures with Python 3.13.0b2 #58

@mgorny

Description

@mgorny

Description of the bug

When running the test suite with Python 3.13.0b2, I'm getting two test failures:

FAILED tests/test_python.py::test_error_raised - assert 'Traceback' in '<p><code>python exec="yes"\nraise ValueError("oh no!")</code></p>'
FAILED tests/test_python.py::test_reporting_errors_in_sessions - assert 'Traceback' in '<p></p>\n<p><code>python exec="1" session="a"\nprint("hello")\nfraise()</code></p>'

To Reproduce

With Python 3.13:

pip install . markupsafe pygments pytest
python -m pytest

Full traceback

Full traceback
========================================================= test session starts =========================================================
platform linux -- Python 3.13.0b2, pytest-8.2.2, pluggy-1.5.0
rootdir: /tmp/markdown-exec
configfile: pyproject.toml
collected 50 items                                                                                                                    

tests/test_base_formatter.py ........                                                                                           [ 16%]
tests/test_converter.py ........                                                                                                [ 32%]
tests/test_headings.py .                                                                                                        [ 34%]
tests/test_python.py ..F..F...                                                                                                  [ 52%]
tests/test_shell.py ....                                                                                                        [ 60%]
tests/test_toc.py ...                                                                                                           [ 66%]
tests/test_tree.py .                                                                                                            [ 68%]
tests/test_validator.py ................                                                                                        [100%]

============================================================== FAILURES ===============================================================
__________________________________________________________ test_error_raised __________________________________________________________

md = <markdown.core.Markdown object at 0x7f537bff27b0>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f537c463770>

    def test_error_raised(md: Markdown, caplog: pytest.LogCaptureFixture) -> None:
        """Assert errors properly log a warning and return a formatted traceback.
    
        Parameters:
            md: A Markdown instance (fixture).
            caplog: Pytest fixture to capture logs.
        """
        html = md.convert(
            dedent(
                """
                ```python exec="yes"
                raise ValueError("oh no!")
                ```
                """,
            ),
        )
>       assert "Traceback" in html
E       assert 'Traceback' in '<p><code>python exec="yes"\nraise ValueError("oh no!")</code></p>'

tests/test_python.py:66: AssertionError
__________________________________________________ test_reporting_errors_in_sessions __________________________________________________

md = <markdown.core.Markdown object at 0x7f537bff2b30>, caplog = <_pytest.logging.LogCaptureFixture object at 0x7f537c24b390>

    def test_reporting_errors_in_sessions(md: Markdown, caplog: pytest.LogCaptureFixture) -> None:
        """Assert errors and source lines are correctly reported across sessions.
    
        Parameters:
            md: A Markdown instance (fixture).
            caplog: Pytest fixture to capture logs.
        """
        html = md.convert(
            dedent(
                """
                ```python exec="1" session="a"
                def fraise():
                    raise RuntimeError("strawberry")
                ```
    
                ```python exec="1" session="a"
                print("hello")
                fraise()
                ```
                """,
            ),
        )
>       assert "Traceback" in html
E       assert 'Traceback' in '<p></p>\n<p><code>python exec="1" session="a"\nprint("hello")\nfraise()</code></p>'

tests/test_python.py:162: AssertionError
======================================================= short test summary info =======================================================
FAILED tests/test_python.py::test_error_raised - assert 'Traceback' in '<p><code>python exec="yes"\nraise ValueError("oh no!")</code></p>'
FAILED tests/test_python.py::test_reporting_errors_in_sessions - assert 'Traceback' in '<p></p>\n<p><code>python exec="1" session="a"\nprint("hello")\nfraise()</code></p>'
==================================================== 2 failed, 48 passed in 0.16s =====================================================

Expected behavior

Tests passing :-).

Environment information

  • System: Linux-6.9.5-gentoo-dist-x86_64-AMD_Ryzen_5_3600_6-Core_Processor-with-glibc2.39
  • Python: cpython 3.13.0b2 (/tmp/markdown-exec/.venv/bin/python)
  • Environment variables:
  • Installed packages:
    • markdown-exec v1.9.2

Additional context

Reproduced in git @ ed18c5f.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions