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

test_urllib2 alters the execution environment (unsetting no_proxy) #127591

Open
xry111 opened this issue Dec 4, 2024 · 1 comment
Open

test_urllib2 alters the execution environment (unsetting no_proxy) #127591

xry111 opened this issue Dec 4, 2024 · 1 comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error

Comments

@xry111
Copy link
Contributor

xry111 commented Dec 4, 2024

Bug report

Bug description:

Running the Python-3.13.1 test suite with make test, and:

1 test altered the execution environment (env changed):
    test_urllib2

The offending code pattern in several test cases is:

os.environ['no_proxy'] = '*'
# ... ...
del os.environ['no_proxy']

Thus if no_proxy already exists in the environment variable, these tests will remove it.

CPython versions tested on:

3.13

Operating systems tested on:

Linux

@xry111 xry111 added the type-bug An unexpected behavior, bug, or error label Dec 4, 2024
@graingert
Copy link
Contributor

Ah could we use mock.patch.dict instead?

@tomasr8 tomasr8 added the tests Tests in the Lib/test dir label Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests Tests in the Lib/test dir type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants