Skip to content

Commit d2dc35b

Browse files
authored
add caplog for failed cases
1 parent 50cb0ec commit d2dc35b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

allure-pytest-bdd/src/pytest_bdd_listener.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from allure_commons.model2 import Label
66
from allure_commons.model2 import Status
77

8-
from allure_commons.types import LabelType
8+
from allure_commons.types import LabelType, AttachmentType
99
from allure_commons.utils import platform_label
1010
from allure_commons.utils import host_tag, thread_tag
1111
from allure_commons.utils import md5
@@ -115,6 +115,9 @@ def pytest_runtest_makereport(self, item, call):
115115
test_result.status = status
116116
test_result.statusDetails = status_details
117117

118+
if test_result.status != Status.PASSED and report.caplog:
119+
self.attach_data(report.caplog, "log", AttachmentType.TEXT, None)
120+
118121
if report.when == 'teardown':
119122
self.lifecycle.write_test_case(uuid=uuid)
120123

0 commit comments

Comments
 (0)