From 9883a22401cc59bfebac0e85b4588e8eb3c9e8e5 Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Fri, 18 Sep 2026 17:02:38 +0700 Subject: [PATCH 1/2] feat(commons): atomic result write --- .../src/allure_commons/logger.py | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/allure-python-commons/src/allure_commons/logger.py b/allure-python-commons/src/allure_commons/logger.py index 4345bc77..85975493 100644 --- a/allure-python-commons/src/allure_commons/logger.py +++ b/allure-python-commons/src/allure_commons/logger.py @@ -22,9 +22,15 @@ def _report_item(self, item): indent = INDENT if os.environ.get("ALLURE_INDENT_OUTPUT") else None filename = item.file_pattern.format(prefix=uuid.uuid4()) data = asdict(item, filter=lambda _, v: v or v is False) - with io.open(self._report_dir / filename, "w", encoding="utf8") as json_file: + + tmp_filepath = self._report_dir / f"{filename}.tmp" + final_filepath = self._report_dir / filename + + with io.open(tmp_filepath, "w", encoding="utf8") as json_file: json.dump(data, json_file, indent=indent, ensure_ascii=False) + os.replace(tmp_filepath, final_filepath) + @hookimpl def report_result(self, result): self._report_item(result) @@ -35,17 +41,21 @@ def report_container(self, container): @hookimpl def report_attached_file(self, source, file_name): - destination = self._report_dir / file_name - shutil.copy2(source, destination) + tmp_destination = self._report_dir / f"{file_name}.tmp" + final_destination = self._report_dir / file_name + shutil.copy2(source, tmp_destination) + os.replace(tmp_destination, final_destination) @hookimpl def report_attached_data(self, body, file_name): - destination = self._report_dir / file_name - with open(destination, "wb") as attached_file: + tmp_destination = self._report_dir / f"{file_name}.tmp" + final_destination = self._report_dir / file_name + with open(tmp_destination, "wb") as attached_file: if isinstance(body, str): attached_file.write(body.encode("utf-8")) else: attached_file.write(body) + os.replace(tmp_destination, final_destination) @hookimpl def report_globals(self, globals_item): From 315e3767b5ee2ab7ab78e56a8ae89a7c7557a41d Mon Sep 17 00:00:00 2001 From: Maksim Stepanov <17935127+delatrie@users.noreply.github.com> Date: Fri, 18 Sep 2026 17:29:14 +0700 Subject: [PATCH 2/2] test(robot): remove console log from test case --- .../robotframework_support/statuses/statuses_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/allure_robotframework/acceptance/robotframework_support/statuses/statuses_test.py b/tests/allure_robotframework/acceptance/robotframework_support/statuses/statuses_test.py index 97d8c2f8..cc712987 100644 --- a/tests/allure_robotframework/acceptance/robotframework_support/statuses/statuses_test.py +++ b/tests/allure_robotframework/acceptance/robotframework_support/statuses/statuses_test.py @@ -111,7 +111,7 @@ def test_only_failed_steps_have_status_details(docstring, robot_runner: AllureRo FOR ${value} IN @{TEST_VALUES} Run Keyword And Ignore Error Should Be True ${value} > 10 END - Log To Console Test message + No Operation """ robot_runner.run_robotframework( @@ -163,7 +163,7 @@ def test_only_failed_steps_have_status_details(docstring, robot_runner: AllureRo ) ), has_step( - "BuiltIn.Log To Console", + "BuiltIn.No Operation", with_status("passed"), has_status_details({}) )