From 4cfb025a080ca58927701721ac3042f476a5440c Mon Sep 17 00:00:00 2001 From: Bram <13451103+Boost9898@users.noreply.github.com> Date: Wed, 25 Nov 2026 21:44:29 +0100 Subject: [PATCH] test_calibrated_texture_extra: patch the replace_retry that calibrated_texture holds Without numpy the test loads calibrated_texture inside mock.patch.dict(sys.modules), which drops replace_retry from sys.modules again on exit. mock.patch("replace_retry.replace") then imports and patches a second copy, export_file never sees the failure, and the test added in #570 fails. Patch ct.replace_retry directly, which is the same module with or without numpy. --- tests/test_calibrated_texture_extra.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_calibrated_texture_extra.py b/tests/test_calibrated_texture_extra.py index d76eb17471..1a65d768bd 100644 --- a/tests/test_calibrated_texture_extra.py +++ b/tests/test_calibrated_texture_extra.py @@ -2233,7 +2233,7 @@ def test_export_file_replacement_failure_cleans_temporary_file(self): out = self.root / "replace_fail.dds" with _fake_native_context(), \ - mock.patch("replace_retry.replace", side_effect=OSError("simulated I/O write failure")): + mock.patch.object(ct.replace_retry, "replace", side_effect=OSError("simulated I/O write failure")): with self.assertRaisesRegex(OSError, "simulated I/O write failure"): ct.export_file(pool, 0, out, None, True, self.profile)