idlelib tests: Fix refleak testing of test_zzdummy - #155393
Open
zware wants to merge 1 commit into
Open
Conversation
Create a fresh test config for each test run.
serhiy-storchaka
left a comment
Member
There was a problem hiding this comment.
Check test_zzdummy_user.py -- it can have the same leak.
| usercfg = zzdummy.idleConf.userCfg | ||
| testcfg = { | ||
|
|
||
| make_testcfg = lambda: { |
Member
There was a problem hiding this comment.
Nit: define a function instead of lambda.
def make_testcfg():| text = cls.text = Text(cls.root) | ||
| cls.editor = DummyEditwin(root, text) | ||
| zzdummy.idleConf.userCfg = testcfg | ||
| zzdummy.idleConf.userCfg = make_testcfg() |
Member
There was a problem hiding this comment.
Do this in setUp() instead of setUpClass().
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Create a fresh test config for each test run of
test_zzdummy.This prevents a first-run failure in
test_zzdummy.ZZDummyTest.test_existsdue to what appears to be config pollution caused bytest_zzdummy.ZZDummyMixin.test_reload(at least, hacking the failing check fromtest_existsintotearDownshowstest_reloadto be the first failure). The failure can be seen on the AMD64 Windows Server 2025 Refleaks builder, but is reproducible on Linux as well. Note that it does not cause the full buildbot run to fail, as the polluting test does not get re-run at the end.This is the smallest change I could make to fix the refleak run, but I doubt it's ideal :). If you'd rather treat this as a bug report against the test and fix it a better way, please go ahead!