◐ Shell
reader mode source ↗
Skip to content

bpo-34200: Fix non-determinism of test_pkg#9248

Merged
miss-islington merged 3 commits into
python:masterfrom
gpshead:test_pkg_b34200_hell
Sep 13, 2018
Merged

bpo-34200: Fix non-determinism of test_pkg#9248
miss-islington merged 3 commits into
python:masterfrom
gpshead:test_pkg_b34200_hell

Conversation

@gpshead

@gpshead gpshead commented Sep 13, 2018

Copy link
Copy Markdown
Member

This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.

https://bugs.python.org/issue34200

test_pkg was using test.support.modules_setup() and
test.support.modules_cleanup() in an attempt to save and restore the
sys.modules contents before and after tests in setUp and tearDown.

An example side effect of this was that Python startup time only code
paths such as 'import _bootlocale' being executed from
locale.getpreferredencoding() within many of the test cases testing
imports happening.
@miss-islington

Copy link
Copy Markdown
Contributor

@gpshead: Status check is done, and it's a success ✅ .

@miss-islington miss-islington merged commit 4ae8ece into python:master Sep 13, 2018
@miss-islington

Copy link
Copy Markdown
Contributor

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 13, 2018
This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.

https://bugs.python.org/issue34200
(cherry picked from commit 4ae8ece)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
@bedevere-bot

Copy link
Copy Markdown

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

@bedevere-bot

Copy link
Copy Markdown

GH-9253 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 Sep 13, 2018
This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.

https://bugs.python.org/issue34200
(cherry picked from commit 4ae8ece)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington added a commit that referenced this pull request Sep 13, 2018
This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.

https://bugs.python.org/issue34200
(cherry picked from commit 4ae8ece)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
miss-islington added a commit that referenced this pull request Sep 13, 2018
This causes the tearDown code to only unimport the test modules specifically created as part of each test via the self.mkhier method rather than abusing test.support.modules_setup() and the scary test.support.modules_cleanup() code.

https://bugs.python.org/issue34200
(cherry picked from commit 4ae8ece)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants