Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Test failures with Python 3.13.0b2 #58

Closed
mgorny opened this issue Jun 20, 2024 · 2 comments
Closed

bug: Test failures with Python 3.13.0b2 #58

mgorny opened this issue Jun 20, 2024 · 2 comments
Assignees

Comments

@mgorny
Copy link

mgorny commented Jun 20, 2024

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.

@pawamoy
Copy link
Owner

pawamoy commented Jun 24, 2024

Thanks for the report. Non Python 3.13 compatible docs dependencies were preventing tests to run locally with Python 3.13, so I didn't spot this issue. I've fixed both the setup and the code to test and support Python 3.13 🙂 Released as v1.9.3.

@pawamoy pawamoy closed this as completed Jun 24, 2024
@mgorny
Copy link
Author

mgorny commented Jun 24, 2024

Thanks! I can confirm that 1.9.3 works for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants