From 899f5c9c33f80c3ba193988e6d5bec21a89597ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miriam=20Espa=C3=B1a=20Acebal?= Date: Wed, 19 Jun 2024 17:06:57 +0200 Subject: [PATCH] Avoiding mocked exception from being lost on test If another exception arises (that's the case here when python 3.12 is used due to the changes in os.shutil.rmtree), the mocked exception is lost because it is incomplete (neither errno nor strerror are set: it goes to args). --- tests/ga/test_exthandlers_exthandlerinstance.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/ga/test_exthandlers_exthandlerinstance.py b/tests/ga/test_exthandlers_exthandlerinstance.py index 846bb89e92..5b98c9f41c 100644 --- a/tests/ga/test_exthandlers_exthandlerinstance.py +++ b/tests/ga/test_exthandlers_exthandlerinstance.py @@ -117,7 +117,7 @@ def test_rm_ext_handler_dir_should_report_an_event_if_an_error_occurs_while_dele def mock_remove(path, dir_fd=None): # pylint: disable=unused-argument if path.endswith("extension_file2"): - raise IOError("A mocked error") + raise IOError(999,"A mocked error","extension_file2") original_remove_api(path) with patch.object(shutil.os, remove_api_name, mock_remove):