allure-framework / allure-framework/allure-python

Attachments doesnt works with pre-test fixtures

Abierto
#475 1 comentario 2 reacciones 0 asignados Ver en GitHub
bug theme:pytest-bdd
Lenguaje dominante
Python
Estrellas
814
Forks
260
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

@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

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Comienza reproduciendo el fixture con ámbito de sesión en test/conftest.py e inspecciona test/commons/utils/reporting_utils.py, especialmente attach_json_to_report. Sigue el fallo reportado a través del ciclo de vida de allure_pytest_bdd y allure_commons lifecycle.py. Se considera terminado cuando los adjuntos de los fixtures previos a la prueba ya no provocan un KeyError cuando no hay ningún elemento ejecutable activo.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
python
Área
testing
Tipo de issue
Error
Dificultad
3/5
Tiempo estimado
1-2 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.