Skip to content

gh-155423: Make BaseFileTest.tearDown() in test_logging robust - #155424

Merged
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:test-logging-teardown
Aug 9, 2026
Merged

gh-155423: Make BaseFileTest.tearDown() in test_logging robust#155424
serhiy-storchaka merged 1 commit into
python:mainfrom
serhiy-storchaka:test-logging-teardown

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Aug 9, 2026

Copy link
Copy Markdown
Member

Call BaseTest.tearDown() from a finally block, and unlink the log files with os_helper.unlink(), which ignores a missing file.

Always call BaseTest.tearDown(), which removes the handlers added by
setUp(), even if unlinking the log files fails.  Tolerate an already
removed file.
@serhiy-storchaka
serhiy-storchaka merged commit 6f7fb6c into python:main Aug 9, 2026
57 checks passed
@serhiy-storchaka
serhiy-storchaka deleted the test-logging-teardown branch August 9, 2026 16:57
@serhiy-storchaka serhiy-storchaka added 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 9, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Aug 9, 2026

Copy link
Copy Markdown

GH-155441 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Aug 9, 2026
@bedevere-app

bedevere-app Bot commented Aug 9, 2026

Copy link
Copy Markdown

GH-155442 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Aug 9, 2026
@bedevere-app

bedevere-app Bot commented Aug 9, 2026

Copy link
Copy Markdown

GH-155443 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Aug 9, 2026
serhiy-storchaka added a commit that referenced this pull request Aug 9, 2026
…GH-155424) (GH-155442)

Always call BaseTest.tearDown(), which removes the handlers added by
setUp(), even if unlinking the log files fails.  Tolerate an already
removed file.
(cherry picked from commit 6f7fb6c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Aug 9, 2026
…GH-155424) (GH-155443)

Always call BaseTest.tearDown(), which removes the handlers added by
setUp(), even if unlinking the log files fails.  Tolerate an already
removed file.
(cherry picked from commit 6f7fb6c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
hugovk pushed a commit that referenced this pull request Aug 12, 2026
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.

2 participants