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

PyPy3.10: tests/ui/test_exception_trace.py::test_render_debug_better_error_message_recursion_error fails #386

Open
mgorny opened this issue Nov 20, 2023 · 1 comment

Comments

@mgorny
Copy link

mgorny commented Nov 20, 2023

When running the test suite on PyPy3.10 7.3.13, I'm getting the following test failure:

$ poetry run pytest
............................................................................................................................... [ 49%]
................................................................F.....................................s........................ [ 98%]
.....                                                                                                                           [100%]
============================================================== FAILURES ===============================================================
_______________________________________ test_render_debug_better_error_message_recursion_error ________________________________________

    def test_render_debug_better_error_message_recursion_error() -> None:
        io = BufferedIO()
        io.set_verbosity(Verbosity.DEBUG)
    
        try:
            recursion.recursion_error()
        except RecursionError as e:
            trace = ExceptionTrace(e)
    
        lineno = 83
        trace.render(io)
    
        expected = rf"""^
      Stack trace:
    
      \d+  {re.escape(trace._get_relative_file_path(__file__))}:{lineno} in test_render_debug_better_error_message_recursion_error
             {lineno - 2}\
             {lineno - 1}\│     try:
          →  {lineno + 0}\│         recursion.recursion_error\(\)
             {lineno + 1}\│     except RecursionError as e:
             {lineno + 2}\│         trace = ExceptionTrace\(e\)
    
      ...  Previous frame repeated \d+ times
    
      \s*\d+  {re.escape(trace._get_relative_file_path(recursion.__file__))}:2 in recursion_error
              1\│ def recursion_error\(\) -> None:2\│     recursion_error\(\)
              3\
    
      RecursionError
    
      maximum recursion depth exceeded
    
      at {re.escape(trace._get_relative_file_path(recursion.__file__))}:2 in recursion_error
            1\│ def recursion_error\(\) -> None:2\│     recursion_error\(\)
            3\
    """
    
>       assert re.match(expected, io.fetch_output()) is not None
E       AssertionError: assert None is not None
E        +  where None = <function match at 0x00007fb6301bfd80>('^\n  Stack trace:\n\n  \\d+  tests/ui/test_exception_trace\\.py:83 in test_render_debug_better_error_message_recursio...ursion_error\n        1\\│ def recursion_error\\(\\) -> None:\n    →   2\\│     recursion_error\\(\\)\n        3\\│ \n', '\n  Stack trace:\n\n  1660  tests/ui/test_exception_trace.py:83 in test_render_debug_better_error_message_recursion_e...on.py:2 in recursion_error\n        1│ def recursion_error() -> None:\n    →   2│     recursion_error()\n        3│ \n')
E        +    where <function match at 0x00007fb6301bfd80> = re.match
E        +    and   '\n  Stack trace:\n\n  1660  tests/ui/test_exception_trace.py:83 in test_render_debug_better_error_message_recursion_e...on.py:2 in recursion_error\n        1│ def recursion_error() -> None:\n    →   2│     recursion_error()\n        3│ \n' = <bound method BufferedIO.fetch_output of <cleo.io.buffered_io.BufferedIO object at 0x00007fb62a384608>>()
E        +      where <bound method BufferedIO.fetch_output of <cleo.io.buffered_io.BufferedIO object at 0x00007fb62a384608>> = <cleo.io.buffered_io.BufferedIO object at 0x00007fb62a384608>.fetch_output

tests/ui/test_exception_trace.py:117: AssertionError
======================================================= short test summary info =======================================================
FAILED tests/ui/test_exception_trace.py::test_render_debug_better_error_message_recursion_error - AssertionError: assert None is not None
1 failed, 257 passed, 1 skipped in 1.78s

Apparently the actual output is:


  Stack trace:

  1660  tests/ui/test_exception_trace.py:83 in test_render_debug_better_error_message_recursion_error
          81│ 
          82│     try:
       →  83│         recursion.recursion_error()
          84│     except RecursionError as e:
          85│         trace = ExceptionTrace(e)

   ...  Previous frame repeated 1658 times

     1  tests/fixtures/exceptions/recursion.py:2 in recursion_error
           1│ def recursion_error() -> None:
       →   2│     recursion_error()
           3│ 

  RecursionError

  maximum recursion depth exceeded

  at tests/fixtures/exceptions/recursion.py:2 in recursion_error
        1│ def recursion_error() -> None:
    →   2│     recursion_error()
        3│ 

@Secrus
Copy link
Member

Secrus commented Nov 27, 2023

We don't test against PyPy, I guess there are some differences in how CPython and PyPy handle recursion. Feel free to submit a PR to fix this. I won't prioritize this now, since there are other, more important, things to take care of.

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

No branches or pull requests

2 participants