Skip to content

Restore piece_size_min_default in finally block#62

Merged
rndusr merged 1 commit into
rndusr:masterfrom
nadzyah:piece_size_min_default
May 1, 2026
Merged

Restore piece_size_min_default in finally block#62
rndusr merged 1 commit into
rndusr:masterfrom
nadzyah:piece_size_min_default

Conversation

@nadzyah
Copy link
Copy Markdown
Contributor

@nadzyah nadzyah commented Apr 30, 2026

forced_piece_size restores Torrent.piece_size_min_default after the with mock.patch() block. When a test raises, the exception propagates through the with block and the restore line is skipped, leaving piece_size_min_default at the test value for all subsequent tests in the same worker process

Move the restore into a try/finally to guarantee it runs regardless of whether an exception propagates

The error occurred while running CI autopkgtests for the torf package in Debian on amd64 and arm64 arches

forced_piece_size restores Torrent.piece_size_min_default after the
with mock.patch() block. When a test raises, the exception propagates
through the with block and the restore line is skipped, leaving
piece_size_min_default at the test value for all subsequent tests in the
same worker process

Move the restore into a try/finally to guarantee it runs regardless of
whether an exception propagates
@rndusr rndusr merged commit 7a86a6b into rndusr:master May 1, 2026
@nadzyah nadzyah deleted the piece_size_min_default branch May 1, 2026 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants