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

@zware zware 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 owner August 8, 2026 18:06
@zware zware 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
@zware
zware requested a review from serhiy-storchaka August 8, 2026 18:06

@serhiy-storchaka serhiy-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.

def make_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().

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

Labels

awaiting core review 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 skip issue skip news tests Tests in the Lib/test dir topic-IDLE type-bug An unexpected behavior, bug, or error

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants