Skip to content

bpo-25094: Fix test_tools.test_sundry() on Windows #8406

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

Merged
merged 1 commit into from
Jul 23, 2018
Merged

bpo-25094: Fix test_tools.test_sundry() on Windows #8406

merged 1 commit into from
Jul 23, 2018

Conversation

vstinner
Copy link
Member

@vstinner vstinner commented Jul 23, 2018

When Python is installed on Windows, python -m test test_tools
failed. Fix test_sundry() test by fixing sys.argv before loading
scripts. Run 2to3 with one argument: test_tools/test_sundry.py.

Modify also the unit test to unload all modules which have been
loaded by the test. Moreover, use CleanImport() context manager to
make sure that 'name' module is not already loaded.

https://bugs.python.org/issue25094

When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
@vstinner
Copy link
Member Author

I tested manually my fix on an installed Python 3.6 by replacing C:\Python36\Lib\test\test_tools\test_sundry.py: the fix works as expected.

@vstinner vstinner merged commit 752d4b7 into python:master Jul 23, 2018
@miss-islington
Copy link
Contributor

Thanks @vstinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.6, 3.7.
🐍🍒⛏🤖

@vstinner vstinner deleted the test_sundry branch July 23, 2018 11:18
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2018
When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
(cherry picked from commit 752d4b7)

Co-authored-by: Victor Stinner <[email protected]>
@bedevere-bot
Copy link

GH-8407 is a backport of this pull request to the 3.7 branch.

@bedevere-bot
Copy link

GH-8408 is a backport of this pull request to the 3.6 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 23, 2018
When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
(cherry picked from commit 752d4b7)

Co-authored-by: Victor Stinner <[email protected]>
miss-islington added a commit that referenced this pull request Jul 23, 2018
When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
(cherry picked from commit 752d4b7)

Co-authored-by: Victor Stinner <[email protected]>
vstinner added a commit that referenced this pull request Jul 23, 2018
When Python is installed on Windows, python -m test test_tools failed
because it tried to run Tools\scripts\2to3.py which requires an
argument. Skip this script. On other platforms or on Windows but when
run from source code (not installed), the script is called "2to3"
instead of "2to.py" and so was already skipped.

Modify also the unit test to unload all modules which have been
loaded by the test.
(cherry picked from commit 752d4b7)

Co-authored-by: Victor Stinner <[email protected]>
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.

4 participants