Skip to content

gh-67765: Tests for wsgiref to increase coverage, converted patches to PR - #112398

Merged
serhiy-storchaka merged 4 commits into
python:mainfrom
MannarAmuthan:wsgiref_validate_tests
Aug 12, 2026
Merged

serhiy-storchaka merged 4 commits into
python:mainfrom
MannarAmuthan:wsgiref_validate_tests

Conversation

@MannarAmuthan

@MannarAmuthan MannarAmuthan commented Nov 25, 2023 •

Copy link
Copy Markdown
Contributor

The original old patch, which increases test coverage is validated, and it is still relevant.
So I converted the patch to Github PR, as asked in the below issue.

Issue: #67765
Original Patch: https://bugs.python.org/file38321/wsgiref_test_wrappers.patch

@ghost

ghost commented Nov 25, 2023 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.
CLA signed

@bedevere-app bedevere-app Bot added the tests Tests in the Lib/test dir label Nov 25, 2023
@bedevere-app

bedevere-app Bot commented Nov 25, 2023

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@bedevere-app

bedevere-app Bot commented Nov 25, 2023

Copy link
Copy Markdown

Most changes to Python require a NEWS entry. Add one using the blurb_it web app or the blurb command-line tool.

If this change has little impact on Python users, wait for a maintainer to apply the skip news label instead.

@MannarAmuthan

Copy link
Copy Markdown
Contributor Author

Before the patch:

Name Stmts Miss Branch BrPart Cover
Lib/wsgiref/validate.py 184 37 50 14 75%

After the patch:

Name Stmts Miss Branch BrPart Cover
Lib/wsgiref/validate.py 184 17 50 14 86%

@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Apr 14, 2026
assertTrue() was used with the expected value as the message.

@serhiy-storchaka serhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. 👍

@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 only security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes and removed stale Stale PR or inactive for long period of time. labels Aug 12, 2026
@serhiy-storchaka
serhiy-storchaka merged commit e96cf73 into python:main Aug 12, 2026
60 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @MannarAmuthan for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Sorry, @MannarAmuthan and @serhiy-storchaka, I could not cleanly backport this to 3.14 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e96cf738e810df38531de0973f561ef9fc868e77 3.14

@bedevere-app

bedevere-app Bot commented Aug 12, 2026

Copy link
Copy Markdown

GH-155622 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Aug 12, 2026
@miss-islington-app

Copy link
Copy Markdown

Sorry, @MannarAmuthan and @serhiy-storchaka, I could not cleanly backport this to 3.13 due to a conflict.
Please backport using cherry_picker on command line.

cherry_picker e96cf738e810df38531de0973f561ef9fc868e77 3.13

@bedevere-app

bedevere-app Bot commented Aug 12, 2026

Copy link
Copy Markdown

GH-155624 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 12, 2026
@bedevere-app

bedevere-app Bot commented Aug 12, 2026

Copy link
Copy Markdown

GH-155625 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 only security fixes label Aug 12, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 12, 2026
Cover the InputWrapper and ErrorWrapper methods of wsgiref.validate:
read, readline, readlines, __iter__, write, writelines and flush.
Each is tested both for the AssertionError raised on an invalid call
and for the data passed through on a valid one.

Co-authored-by: Alex Shkop <a.v.shkop@gmail.com>
(cherry picked from commit e96cf73)

* Use ExtraAssertions instead of rewriting the assertions

assertStartsWith() and assertEndsWith() are provided by
test.support.testcase.ExtraAssertions in 3.13, so the new tests can be
kept identical to the 3.14+ version.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Amuthan Mannar <amuthanmannar4@gmail.com>
Co-authored-by: Alex Shkop <a.v.shkop@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
serhiy-storchaka added a commit that referenced this pull request Aug 12, 2026
Cover the InputWrapper and ErrorWrapper methods of wsgiref.validate:
read, readline, readlines, __iter__, write, writelines and flush.
Each is tested both for the AssertionError raised on an invalid call
and for the data passed through on a valid one.

(cherry picked from commit e96cf73)

Co-authored-by: Amuthan Mannar <amuthanmannar4@gmail.com>
Co-authored-by: Alex Shkop <a.v.shkop@gmail.com>
mbeijen pushed a commit to mbeijen/cpython that referenced this pull request Aug 14, 2026
Cover the InputWrapper and ErrorWrapper methods of wsgiref.validate:
read, readline, readlines, __iter__, write, writelines and flush.
Each is tested both for the AssertionError raised on an invalid call
and for the data passed through on a valid one.

Co-authored-by: Alex Shkop <a.v.shkop@gmail.com>
hugovk pushed a commit that referenced this pull request Aug 27, 2026
Co-authored-by: Amuthan Mannar <amuthanmannar4@gmail.com>
Co-authored-by: Alex Shkop <a.v.shkop@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip news tests Tests in the Lib/test dir

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants