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

bpo-34185: Fix test module collision in test_bdb when ran as script #8537

Merged
merged 1 commit into from Dec 5, 2018

Conversation

lajarre
Copy link
Contributor

@lajarre lajarre commented Jul 28, 2018

When running test_bdb.py as a script, import test_module would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.

Indeed, when running ./python Lib/test/test_bdb.py ("as a script"),
sys.path[0] is getting filled with the path to Lib/test.

The chosen solution here was to change the name of the temporary module
created by test_bdb.py .

https://bugs.python.org/issue34185

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.

Indeed, when running `./python Lib/test/test_bdb.py` ("as a script"),
`sys.path[0]` is getting filled with the path to Lib/test.

The chosen solution here was to change the name of the temporary module
created by test_bdb.py .
@bedevere-bot bedevere-bot added the tests Tests in the Lib/test dir label Jul 28, 2018
@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented Jul 28, 2018

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept your contribution by verifying you have signed the PSF contributor agreement (CLA).

Unfortunately our records indicate you have not signed the CLA. For legal reasons we need you to sign this before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

When your account is ready, please add a comment in this pull request
and a Python core developer will remove the CLA not signed label
to make the bot check again.

You can check yourself
to see if the CLA has been received.

Thanks again for your contribution, we look forward to reviewing it!

@serhiy-storchaka serhiy-storchaka merged commit 54fd455 into python:master Dec 5, 2018
@miss-islington
Copy link
Contributor

miss-islington commented Dec 5, 2018

Thanks @lajarre for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 2.7, 3.6, 3.7.
🐍🍒🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 5, 2018
…ythonGH-8537)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.com>
@bedevere-bot
Copy link

bedevere-bot commented Dec 5, 2018

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 5, 2018
…ythonGH-8537)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.com>
@bedevere-bot
Copy link

bedevere-bot commented Dec 5, 2018

GH-10936 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 Dec 5, 2018
…ythonGH-8537)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.com>
@bedevere-bot
Copy link

bedevere-bot commented Dec 5, 2018

GH-10937 is a backport of this pull request to the 2.7 branch.

@serhiy-storchaka
Copy link
Member

serhiy-storchaka commented Dec 5, 2018

Thank you for your contribution @lajarre!

miss-islington added a commit that referenced this pull request Dec 5, 2018
…H-8537)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.com>
miss-islington added a commit that referenced this pull request Dec 5, 2018
…H-8537)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.com>
serhiy-storchaka pushed a commit that referenced this pull request Dec 5, 2018
…H-8537) (GH-10936)

When running test_bdb.py as a script, `import test_module` would be
importing the existing Lib/test/test_modules.py instead of the
tempcwd/test_module.py module which was dynamically created by
test_bdb.py itself.
(cherry picked from commit 54fd455)

Co-authored-by: Alex H <1884912+lajarre@users.noreply.github.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.

None yet

5 participants