allure-framework / allure-framework/allure-python

Attachments doesnt works with pre-test fixtures

オープン
#475 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る
bug theme:pytest-bdd
主要言語
Python
スター
814
フォーク
260
PR マージ指標
30日以内にマージされた PR はありません

説明

@pytest.fixture(autouse=True, scope='session')
def configuration(config):
> attach_json_to_report("Config", config)

test\conftest.py:27:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
test\commons\utils\reporting_utils.py:9: in attach_json_to_report
allure.attach(name=name, body=json, attachment_type=allure.attachment_type.JSON)
.venv\lib\site-packages\allure_commons\_allure.py:164: in __call__
plugin_manager.hook.attach_data(body=body, name=name, attachment_type=attachment_type, extension=extension)
.venv\lib\site-packages\allure_pytest_bdd\pytest_bdd_listener.py:118: in attach_data
self.lifecycle.attach_data(uuid4(), body, name=name, attachment_type=attachment_type, extension=extension)
.venv\lib\site-packages\allure_commons\lifecycle.py:146: in attach_data
file_name = self._attach(uuid, name=name, attachment_type=attachment_type, extension=extension)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = , uuid = None, name = 'Config', attachment_type = , extension = 'json'

def _attach(self, uuid, name=None, attachment_type=None, extension=None):
mime_type = attachment_type
extension = extension if extension else 'attach'

if type(attachment_type) is AttachmentType:
extension = attachment_type.extension
mime_type = attachment_type.mime_type

file_name = ATTACHMENT_PATTERN.format(prefix=uuid, ext=extension)
attachment = Attachment(source=file_name, name=name, type=mime_type)
uuid = self._last_item_uuid(item_type=ExecutableItem)
> self._items[uuid].attachments.append(attachment)
E KeyError: None

.venv\lib\site-packages\allure_commons\lifecycle.py:137: KeyError

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、test/conftest.py にあるセッションスコープの fixture を再現し、test/commons/utils/reporting_utils.py、特に attach_json_to_report を調べてください。報告された失敗を allure_pytest_bdd と allure_commons lifecycle.py のライフサイクルを通して追跡してください。実行可能な item がアクティブでない場合でも、テスト前の fixture からの添付ファイルが KeyError を発生させなくなれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
python
領域
testing
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。