X Tutup
Skip to content

gh-92886: Replace assertion statements in handlers.BaseHandler to support running with optimizations (-O)#93231

Merged
iritkatriel merged 6 commits intopython:mainfrom
jackh-ncl:92886-wsgiref
Oct 19, 2022
Merged

gh-92886: Replace assertion statements in handlers.BaseHandler to support running with optimizations (-O)#93231
iritkatriel merged 6 commits intopython:mainfrom
jackh-ncl:92886-wsgiref

Conversation

@jackh-ncl
Copy link
Contributor

@jackh-ncl jackh-ncl commented May 25, 2022

Replace assert statements with raise AssertionError() so that behaviour is maintained and test_wsgiref.py tests pass while running with optimizations (-O).

#92886

Before:

$ ./python.exe -Om unittest test.test_wsgiref

.......................FFF...........
======================================================================
FAIL: test_status_validation_errors (test.test_wsgiref.IntegrationTests.test_status_validation_errors) (status='200')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/.../dev/cpython/Lib/test/test_wsgiref.py", line 177, in test_status_validation_errors
    self.assertTrue(out.endswith(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true

======================================================================
FAIL: test_status_validation_errors (test.test_wsgiref.IntegrationTests.test_status_validation_errors) (status='20X OK')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/.../dev/cpython/Lib/test/test_wsgiref.py", line 177, in test_status_validation_errors
    self.assertTrue(out.endswith(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true

======================================================================
FAIL: test_status_validation_errors (test.test_wsgiref.IntegrationTests.test_status_validation_errors) (status='200OK')
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/.../dev/cpython/Lib/test/test_wsgiref.py", line 177, in test_status_validation_errors
    self.assertTrue(out.endswith(
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: False is not true

----------------------------------------------------------------------
Ran 35 tests in 0.039s

FAILED (failures=3)

After:

$ ./python.exe -Om unittest test.test_wsgiref

...................................
----------------------------------------------------------------------
Ran 35 tests in 0.030s

OK

Loading
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

Successfully merging this pull request may close these issues.

3 participants

X Tutup