[New-bugs-announce] [issue46111] test_unittest fails in optimized mode

Serhiy Storchaka report at bugs.python.org
Fri Dec 17 02:43:08 EST 2021


New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:

$ ./python -OO -m test -vuall test_unittest
...
======================================================================
FAIL: testShortDescriptionWhitespaceTrimming (unittest.test.test_case.Test_TestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/unittest/test/test_case.py", line 639, in testShortDescriptionWhitespaceTrimming
    self.assertEqual(
    ^^^^^^^^^^^^^^^^^
AssertionError: None != 'Tests shortDescription() whitespace is trimmed, so that the first'

======================================================================
FAIL: test_Exit (unittest.test.test_program.Test_TestProgram)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/unittest/test/test_program.py", line 127, in test_Exit
    self.assertIn('\nFAIL: testFail ', stream.getvalue())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '\nFAIL: testFail ' not found in '..\n----------------------------------------------------------------------\nRan 2 tests in 0.000s\n\nOK\n'

======================================================================
FAIL: test_ExitAsDefault (unittest.test.test_program.Test_TestProgram)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/unittest/test/test_program.py", line 139, in test_ExitAsDefault
    self.assertIn('\nFAIL: testFail ', stream.getvalue())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '\nFAIL: testFail ' not found in '..\n----------------------------------------------------------------------\nRan 2 tests in 0.000s\n\nOK\n'

======================================================================
FAIL: test_NonExit (unittest.test.test_program.Test_TestProgram)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/unittest/test/test_program.py", line 114, in test_NonExit
    self.assertIn('\nFAIL: testFail ', stream.getvalue())
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: '\nFAIL: testFail ' not found in '..\n----------------------------------------------------------------------\nRan 2 tests in 0.000s\n\nOK\n'

======================================================================
FAIL: test_special_attrs (unittest.test.testmock.testpatch.PatchTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/serhiy/py/cpython/Lib/unittest/test/testmock/testpatch.py", line 1880, in test_special_attrs
    self.assertEqual(foo.__doc__, "TEST")
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: None != 'TEST'

----------------------------------------------------------------------

----------
assignee: serhiy.storchaka
components: Tests
messages: 408755
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: test_unittest fails in optimized mode
type: behavior
versions: Python 3.10, Python 3.11, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46111>
_______________________________________


More information about the New-bugs-announce mailing list