Skip to content
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

configure filterwarnings=error #2790

Merged
merged 18 commits into from
Nov 24, 2022
Merged

Conversation

graingert
Copy link
Contributor

No description provided.

@graingert graingert force-pushed the enable-filterwarnings branch 9 times, most recently from 4820a91 to e959487 Compare November 10, 2022 16:50
@graingert graingert marked this pull request as ready for review November 10, 2022 16:50
@pquentin pquentin added the Skip Changelog Pull requests that don't require a changelog entry label Nov 10, 2022
@pquentin
Copy link
Member

pquentin commented Nov 10, 2022

We have this mysterious coverage issue which does not make any sense to me:


Name                                     Stmts   Miss  Cover   Missing
----------------------------------------------------------------------
src/urllib3/util/ssltransport.py           146     24    84%   86, 89, 92, 100, 156, 164-166, 169, 173-174, 177-179, 182, 201, 204, 207, 210, 213, 216, 222, 234, 293

pyproject.toml Outdated Show resolved Hide resolved
@graingert graingert force-pushed the enable-filterwarnings branch from 0d03ce2 to c5f1a53 Compare November 11, 2022 10:27
@graingert
Copy link
Contributor Author

@pquentin ok I fixed that weird coverage issue by rebasing on your pyproject.toml pytest config

@graingert graingert force-pushed the enable-filterwarnings branch 4 times, most recently from 13525bb to 7e381a2 Compare November 12, 2022 12:49
@graingert graingert force-pushed the enable-filterwarnings branch 4 times, most recently from 43a1a4b to a3dc458 Compare November 23, 2022 12:52
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thanks, excellent work!

Comment on lines +119 to +125
try:
with self.server_context.wrap_socket(sock, server_side=True) as ssock:
request = consume_socket(ssock)
validate_request(request)
ssock.send(sample_response())
except (ConnectionAbortedError, ConnectionResetError):
return
Copy link
Member

Choose a reason for hiding this comment

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

Should we use contextlib.suppress here and below?

Also, in what context is it useful? It's not intuitive that this could raise an exception and not actually start the server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You don't use contextlib.suppress anywhere else and I find it to be confusing compared to the regular try/catch

Copy link
Member

Choose a reason for hiding this comment

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

OK, but in what context is it useful? It's not intuitive that this could raise an exception and not actually start the server

Copy link
Contributor Author

Choose a reason for hiding this comment

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

previously it was as if there was a try: .... except BaseException: return there, this is actually just limiting the exceptions to just those. This is because effectively all exceptions in a thread are ignored by default and the filterwarings=error collects those exceptions so we need to do something about the ones that do happen

rather than add PytestUnhandledThreadExceptionWarning to the filterwarnings, as a TODO, I think it's better to do the narrower workaround here

test/with_dummyserver/test_https.py Show resolved Hide resolved
test/with_dummyserver/test_socketlevel.py Outdated Show resolved Hide resolved
test/with_dummyserver/test_socketlevel.py Show resolved Hide resolved
test/with_dummyserver/test_socketlevel.py Outdated Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
@graingert graingert force-pushed the enable-filterwarnings branch from 01115cd to 23eeb08 Compare November 24, 2022 10:17
@graingert graingert requested a review from pquentin November 24, 2022 12:26
Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

only one question left!

Copy link
Member

@pquentin pquentin left a comment

Choose a reason for hiding this comment

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

Thanks! LGTM.

@pquentin pquentin merged commit 94ccda0 into urllib3:main Nov 24, 2022
@graingert graingert deleted the enable-filterwarnings branch November 24, 2022 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Skip Changelog Pull requests that don't require a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants