GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-92886: Replace assertion statements in `handlers.BaseHandler` to support running with optimizations (`-O`) by jackh-ncl · Pull Request #93231 · python/cpython

Conversation

@jackh-ncl

@jackh-ncl jackh-ncl commented May 25, 2022 •
edited by bedevere-bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

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
  • Issue: some tests fail with -O (assertions off) #92886

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Jack Hindmarch
Replace status assertion statements in handlers.py
1e8e482
Replace assert statements with `raise AssertionError()` so that behaviour is maintained and `test_wsgiref.py` tests pass while running with optimizations (`-O`).
@bedevere-bot

bedevere-bot commented May 25, 2022

Copy link
Copy Markdown

Most changes to Python require a NEWS entry.

Please add it using the blurb_it web app or the blurb command-line tool.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-bot bedevere-bot added the awaiting review label May 25, 2022
@blurb-it
📜🤖 Added by blurb_it.
994ca36
@jackh-ncl
jackh-ncl marked this pull request as ready for review May 25, 2022 22:10
iritkatriel
iritkatriel reviewed Oct 18, 2022
View reviewed changes
Comment thread Misc/NEWS.d/next/Library/2022-05-25-22-09-38.gh-issue-92886.ylwDSc.rst Resolved

Uh oh!

There was an error while loading. Please reload this page.

jackh-ncl and others added 2 commits October 18, 2022 17:08
@jackh-ncl @iritkatriel
Update Misc/NEWS.d/next/Library/2022-05-25-22-09-38.gh-issue-92886.yl…
539de23
…wDSc.rst

Co-authored-by: Irit Katriel <[email protected]>
@iritkatriel
Merge branch 'main' into 92886-wsgiref
e38fe39
iritkatriel
iritkatriel approved these changes Oct 18, 2022
View reviewed changes
@bedevere-bot bedevere-bot added awaiting merge and removed awaiting review labels Oct 18, 2022
iritkatriel added 2 commits October 19, 2022 11:06
@iritkatriel
Merge branch 'main' into 92886-wsgiref
6278625
@iritkatriel
Merge branch 'main' into 92886-wsgiref
c0ea1b4
@iritkatriel
iritkatriel merged commit b6e59d7 into python:main Oct 19, 2022
@bedevere-bot bedevere-bot removed the awaiting merge label Oct 19, 2022
carljm added a commit to carljm/cpython that referenced this pull request Oct 20, 2022
@carljm
Merge branch 'main' into typewatch
8bba5da
* main: (40 commits)
  pythongh-98461: Fix source location in comprehensions bytecode (pythonGH-98464)
  pythongh-98421: Clean Up PyObject_Print (pythonGH-98422)
  pythongh-98360: multiprocessing now spawns children on Windows with correct argv[0] in virtual environments (pythonGH-98462)
  CODEOWNERS: Become a typing code owner (python#98480)
  [doc] Improve logging cookbook example. (pythonGH-98481)
  Add more tkinter.Canvas tests (pythonGH-98475)
  pythongh-95023: Added os.setns and os.unshare functions (python#95046)
  pythonGH-98363: Presize the list for batched() (pythonGH-98419)
  pythongh-98374: Suppress ImportError for invalid query for help() command. (pythongh-98450)
  typing tests: `_overload_dummy` raises `NotImplementedError`, not `RuntimeError` (python#98351)
  pythongh-98354: Add unicode check for 'name' attribute in _imp_create_builtin (pythonGH-98412)
  pythongh-98257: Make _PyEval_SetTrace() reentrant (python#98258)
  pythongh-98414: py.exe launcher does not use defaults for -V:company/ option (pythonGH-98460)
  pythongh-98417: Store int_max_str_digits on the Interpreter State (pythonGH-98418)
  Doc: Remove title text from internal links (python#98409)
  [doc] Refresh the venv introduction documentation, and correct the statement about VIRTUAL_ENV (pythonGH-98350)
  Docs: Bump sphinx-lint and fix unbalanced inline literal markup (python#98441)
  pythongh-92886: Replace assertion statements in `handlers.BaseHandler` to support running with optimizations (`-O`) (pythonGH-93231)
  pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `_test_multiprocessing.py` (pythonGH-93233)
  pythongh-92886: Fix tests that fail when running with optimizations (`-O`) in `test_py_compile.py` (pythonGH-93235)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@iritkatriel iritkatriel iritkatriel approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@jackh-ncl @bedevere-bot @iritkatriel
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.