Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't use pytest.allure.attach with @pytest.mark.parametrise #101

Closed
1 task done
rhonyshniuk opened this issue Jul 13, 2017 · 0 comments
Closed
1 task done

Can't use pytest.allure.attach with @pytest.mark.parametrise #101

rhonyshniuk opened this issue Jul 13, 2017 · 0 comments
Assignees
Labels
bug Something isn't working theme:pytest

Comments

@rhonyshniuk
Copy link

rhonyshniuk commented Jul 13, 2017

Can't use pytest.allure.attach with @pytest.mark.parametrise

  • bug report

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

Source code:
@pytest.mark.parametrize('feed_back_img', FEED_BACK_IMG)
def test_send_feed_back(self, feed_back_img):
pytest.allure.attach("test", name="test")

Trace:


/usr/local/lib/python2.7/dist-packages/allure_pytest/helper.py:128: in call
extension=extension)
/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py:745: in call
return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py:339: in _hookexec
return self._inner_hookexec(hook, methods, kwargs)
/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py:334: in
_MultiCall(methods, kwargs, hook.spec_opts).execute()
/usr/local/lib/python2.7/dist-packages/_pytest/vendored_packages/pluggy.py:614: in execute
res = hook_impl.function(*args)
/usr/local/lib/python2.7/dist-packages/allure_pytest/listener.py:163: in pytest_allure_attach_data
self.allure_logger.attach_data(uuid4(), body, name=name, attachment_type=attachment_type, extension=extension)
/usr/local/lib/python2.7/dist-packages/allure/logger.py:103: in attach_data
file_name, destination = self._attach(uuid, name=name, attachment_type=attachment_type, extension=extension)


self = <allure.logger.AllureLogger object at 0x7fa008a3ff50>, uuid = 'a1372954-9226-437a-9c7d-736b302e6adc', name = 'test', attachment_type = None, extension = 'attach'

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)
    destination = os.path.join(self._report_dir, file_name)
    attachment = Attachment(source=file_name, name=name, type=mime_type)
    last_uuid = next(reversed(self._items))
  self._items[last_uuid].attachments.append(attachment)

E AttributeError: 'TestResultContainer' object has no attribute 'attachments'

What is the expected behavior?

Attach text to allure report

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Other information

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme:pytest
Projects
None yet
Development

No branches or pull requests

2 participants