Skip to content

Running Lib/test/test_weakref.py directly fails  #123046

Closed
@Eclips4

Description

@Eclips4

Bug report

Bug description:

eclips4@nixos ~/p/p/cpython (main) [2]> ./python Lib/test/test_weakref.py
..................................................................................F....F.................................................
======================================================================
FAIL: test_proxy_repr (__main__.ReferencesTestCase.test_proxy_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/eclips4/programming/programming-languages/cpython/Lib/test/test_weakref.py", line 232, in test_proxy_repr
    self.assertRegex(repr(ref),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
                     rf"<weakproxy at 0x[0-9a-fA-F]+; "
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     rf"to '{C.__module__}.{C.__qualname__}' "
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     rf"at 0x[0-9a-fA-F]+>")
                     ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: "<weakproxy at 0x[0-9a-fA-F]+; to '__main__.C' at 0x[0-9a-fA-F]+>" not found in "<weakproxy at 0x7ff9bb9e5ef0; to 'C' at 0x7ff9bbbdcd80>"

======================================================================
FAIL: test_ref_repr (__main__.ReferencesTestCase.test_ref_repr)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/eclips4/programming/programming-languages/cpython/Lib/test/test_weakref.py", line 126, in test_ref_repr
    self.assertRegex(repr(ref),
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^
                     rf"<weakref at 0x[0-9a-fA-F]+; "
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     rf"to '{C.__module__}.{C.__qualname__}' "
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                     rf"at 0x[0-9a-fA-F]+>")
                     ^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Regex didn't match: "<weakref at 0x[0-9a-fA-F]+; to '__main__.C' at 0x[0-9a-fA-F]+>" not found in "<weakref at 0x7ff9bb9e7230; to 'C' at 0x7ff9bb9e7d30>"

----------------------------------------------------------------------
Ran 137 tests in 25.733s

FAILED (failures=2)

CPython versions tested on:

CPython main branch

Operating systems tested on:

Linux

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    testsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions