Skip to content

test_functools fails when run with -OO #115264

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

Closed
sobolevn opened this issue Feb 10, 2024 · 0 comments
Closed

test_functools fails when run with -OO #115264

sobolevn opened this issue Feb 10, 2024 · 0 comments
Assignees
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@sobolevn
Copy link
Member

sobolevn commented Feb 10, 2024

Bug report

Output:

======================================================================
FAIL: test_doc (test.test_functools.TestCachedProperty.test_doc)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 3126, in test_doc
    self.assertEqual(CachedCostItem.cost.__doc__, "The cost of the item.")
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'The cost of the item.'

======================================================================
FAIL: test_double_wrapped_methods (test.test_functools.TestSingleDispatch.test_double_wrapped_methods) (meth=<function TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.cls_context_manager at 0x105c34a10>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2798, in test_double_wrapped_methods
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_double_wrapped_methods (test.test_functools.TestSingleDispatch.test_double_wrapped_methods) (meth=<function TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.cls_context_manager at 0x105ced0d0>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2798, in test_double_wrapped_methods
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_double_wrapped_methods (test.test_functools.TestSingleDispatch.test_double_wrapped_methods) (meth=<function TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.decorated_classmethod at 0x105ced250>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2798, in test_double_wrapped_methods
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_double_wrapped_methods (test.test_functools.TestSingleDispatch.test_double_wrapped_methods) (meth=<function TestSingleDispatch.test_double_wrapped_methods.<locals>.WithSingleDispatch.decorated_classmethod at 0x105ced310>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2798, in test_double_wrapped_methods
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.func at 0x105c36d50>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.func at 0x105c36b10>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.cls_func at 0x105c36510>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.cls_func at 0x105c365d0>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.static_func at 0x105c368d0>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

======================================================================
FAIL: test_method_wrapping_attributes (test.test_functools.TestSingleDispatch.test_method_wrapping_attributes) (meth=<function TestSingleDispatch.test_method_wrapping_attributes.<locals>.A.static_func at 0x105c37d10>)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/sobolev/Desktop/cpython2/Lib/test/test_functools.py", line 2709, in test_method_wrapping_attributes
    self.assertEqual(meth.__doc__, 'My function docstring')
    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'My function docstring'

----------------------------------------------------------------------
Ran 262 tests in 0.124s

FAILED (failures=11, skipped=4)
test test_functools failed
test_functools failed (11 failures)

== Tests result: FAILURE ==

1 test failed:
    test_functools

Total duration: 229 ms
Total tests: run=262 failures=11 skipped=4
Total test files: run=1/1 failed=1
Result: FAILURE

I have a PR ready.

Linked PRs

@sobolevn sobolevn added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir labels Feb 10, 2024
@sobolevn sobolevn self-assigned this Feb 10, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 13, 2024
(cherry picked from commit 27df81d)

Co-authored-by: Nikita Sobolev <[email protected]>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 13, 2024
(cherry picked from commit 27df81d)

Co-authored-by: Nikita Sobolev <[email protected]>
sobolevn added a commit that referenced this issue Mar 13, 2024
…116706)

gh-115264: Fix `test_functools` with `-00` mode (GH-115276)
(cherry picked from commit 27df81d)

Co-authored-by: Nikita Sobolev <[email protected]>
sobolevn added a commit that referenced this issue Mar 13, 2024
…116707)

gh-115264: Fix `test_functools` with `-00` mode (GH-115276)
(cherry picked from commit 27df81d)

Co-authored-by: Nikita Sobolev <[email protected]>
vstinner pushed a commit to vstinner/cpython that referenced this issue Mar 20, 2024
adorilson pushed a commit to adorilson/cpython that referenced this issue Mar 25, 2024
diegorusso pushed a commit to diegorusso/cpython that referenced this issue Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant