Skip to content

Commit

Permalink
Added logs to pytest bdd report
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan authored and Ivan committed Aug 25, 2023
1 parent 200b717 commit 93e88a2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion allure-pytest-bdd/src/pytest_bdd_listener.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from allure_commons.model2 import Label
from allure_commons.model2 import Status

from allure_commons.types import LabelType
from allure_commons.types import LabelType, AttachmentType
from allure_commons.utils import platform_label
from allure_commons.utils import host_tag, thread_tag
from allure_commons.utils import md5
Expand Down Expand Up @@ -114,6 +114,12 @@ def pytest_runtest_makereport(self, item, call):
if test_result.status == Status.PASSED and status != Status.PASSED:
test_result.status = status
test_result.statusDetails = status_details
if report.caplog:
self.attach_data(report.caplog, "log", AttachmentType.TEXT, None)
if report.capstdout:
self.attach_data(report.capstdout, "stdout", AttachmentType.TEXT, None)
if report.capstderr:
self.attach_data(report.capstderr, "stderr", AttachmentType.TEXT, None)

if report.when == 'teardown':
self.lifecycle.write_test_case(uuid=uuid)
Expand Down

0 comments on commit 93e88a2

Please sign in to comment.