Skip to content

idlelib tests: Fix refleak testing of test_zzdummy - #155393

Open
zware wants to merge 1 commit into
python:mainfrom
zware:idle_refleak_test_fix
Open

idlelib tests: Fix refleak testing of test_zzdummy#155393
zware wants to merge 1 commit into
python:mainfrom
zware:idle_refleak_test_fix

Conversation

@zware

@zwarezware commented Aug 8, 2026

Copy link
Copy Markdown
Member

Create a fresh test config for each test run of test_zzdummy.

This prevents a first-run failure in test_zzdummy.ZZDummyTest.test_exists due to what appears to be config pollution caused by test_zzdummy.ZZDummyMixin.test_reload (at least, hacking the failing check from test_exists into tearDown shows test_reload to 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!

Create a fresh test config for each test run.
@zware
zware requested a review from terryjreedy as a code ownerAugust 8, 2026 18:06
@zwarezware added type-bug An unexpected behavior, bug, or error tests Tests in the Lib/test dir skip issue skip news topic-IDLE needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Aug 8, 2026

@serhiy-storchakaserhiy-storchaka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check test_zzdummy_user.py -- it can have the same leak.

usercfg = zzdummy.idleConf.userCfg
testcfg = {

make_testcfg = lambda: {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: define a function instead of lambda.

defmake_testcfg():

text = cls.text = Text(cls.root)
cls.editor = DummyEditwin(root, text)
zzdummy.idleConf.userCfg = testcfg
zzdummy.idleConf.userCfg = make_testcfg()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do this in setUp() instead of setUpClass().

@terryjreedy

Copy link
Copy Markdown
Member

The changes made a few months ago to test_zzdummy and the creation of a 2nd test file are, I am rather sure, wrong and should be reverted. The new test does not test anything worthwhile, in particular, it does not properly test the new feature it was meant to test. I did not do it yet because a) I discovered this about a month ago when Serhiy contributed about 14 patches that I considered higher priority (along with some other IDLE stuff) to investigate and justify; and b) I was not sure whether any of the rest of the merge needed reversion or modification. So I suggest you find the issue, revert the test changes, and backport, including to 3.15. If you do a clean revert, consider this comment my pre-review and approval.

If there is still a leak, meaning that there was one before the change, fix it. And I approve of Serhiy's two suggestions if still relevant after the reversion. I am off to bed now.

@terryjreedyterryjreedy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert last springs changes and splitting into 2 files. Then fix as needed.

@bedevere-app

Copy link
Copy Markdown

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting changesneeds backport to 3.13bugs and security fixesneeds backport to 3.14bugs and security fixesneeds backport to 3.15pre-release feature fixes, bugs and security fixesskip issueskip newstestsTests in the Lib/test dirtopic-IDLEtype-bugAn unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

@zware@terryjreedy@serhiy-storchaka