{"action":"created","issue":{"url":"https://api.github.com/repos/davehunt/pytest-html/issues/7","labels_url":"https://api.github.com/repos/davehunt/pytest-html/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/davehunt/pytest-html/issues/7/comments","events_url":"https://api.github.com/repos/davehunt/pytest-html/issues/7/events","html_url":"https://github.com/davehunt/pytest-html/issues/7","id":80987111,"number":7,"title":"AttributeError: 'TestReport' object has no attribute 'extra'","user":{"login":"reddypdl","id":914786,"avatar_url":"https://avatars.githubusercontent.com/u/914786?v=3","gravatar_id":"","url":"https://api.github.com/users/reddypdl","html_url":"https://github.com/reddypdl","followers_url":"https://api.github.com/users/reddypdl/followers","following_url":"https://api.github.com/users/reddypdl/following{/other_user}","gists_url":"https://api.github.com/users/reddypdl/gists{/gist_id}","starred_url":"https://api.github.com/users/reddypdl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/reddypdl/subscriptions","organizations_url":"https://api.github.com/users/reddypdl/orgs","repos_url":"https://api.github.com/users/reddypdl/repos","events_url":"https://api.github.com/users/reddypdl/events{/privacy}","received_events_url":"https://api.github.com/users/reddypdl/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-26T14:27:45Z","updated_at":"2015-05-26T15:26:51Z","closed_at":"2015-05-26T15:26:51Z","body":"Tried to add the code below, but got error - AttributeError: 'TestReport' object has no attribute 'extra'\r\n\r\nfrom py.xml import html\r\nfrom html import extras\r\n\r\ndef pytest_runtest_makereport(__multicall__, item):\r\n    report = __multicall__.execute()\r\n    extra = getattr(report, 'extra', [])\r\n    if report.when == 'call':\r\n        xfail = hasattr(report, 'wasxfail')\r\n        if (report.skipped and xfail) or (report.failed and not xfail):\r\n            url = TestSetup.selenium.current_url\r\n            report.extra.append(extras.url(url))\r\n            screenshot = TestSetup.selenium.get_screenshot_as_base64()\r\n            report.extra.append(extras.image(screenshot, 'Screenshot'))\r\n            html = TestSetup.selenium.page_source.encode('utf-8')\r\n            report.extra.append(extra.text(html, 'HTML'))\r\n            report.extra.append(extra.html(html.div('Additional HTML')))\r\n        report.extra = extra\r\n    return report\r\n\r\nINTERNALERROR> Traceback (most recent call last):\r\nINTERNALERROR>   File \"D:\\Python27\\lib\\site-packages\\_pytest\\main.py\", line 84, in wrap_session\r\nINTERNALERROR>     doit(config, session)\r\nINTERNALERROR>   File \"D:\\Python27\\lib\\site-packages\\_pytest\\main.py\", line 122, in _main\r\nINTERNALERROR>     config.hook.pytest_runtestloop(session=session)\r\n...........................\r\npytest_runtest_makereport\r\nINTERNALERROR>     report.extra.append(extra.text(item._obj.__doc__.strip(), 'HTML'))\r\nINTERNALERROR> AttributeError: 'TestReport' object has no attribute 'extra'\r\n"},"comment":{"url":"https://api.github.com/repos/davehunt/pytest-html/issues/comments/105567501","html_url":"https://github.com/davehunt/pytest-html/issues/7#issuecomment-105567501","issue_url":"https://api.github.com/repos/davehunt/pytest-html/issues/7","id":105567501,"user":{"login":"davehunt","id":122800,"avatar_url":"https://avatars.githubusercontent.com/u/122800?v=3","gravatar_id":"","url":"https://api.github.com/users/davehunt","html_url":"https://github.com/davehunt","followers_url":"https://api.github.com/users/davehunt/followers","following_url":"https://api.github.com/users/davehunt/following{/other_user}","gists_url":"https://api.github.com/users/davehunt/gists{/gist_id}","starred_url":"https://api.github.com/users/davehunt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davehunt/subscriptions","organizations_url":"https://api.github.com/users/davehunt/orgs","repos_url":"https://api.github.com/users/davehunt/repos","events_url":"https://api.github.com/users/davehunt/events{/privacy}","received_events_url":"https://api.github.com/users/davehunt/received_events","type":"User","site_admin":false},"created_at":"2015-05-26T15:26:51Z","updated_at":"2015-05-26T15:26:51Z","body":"It looks like you've just copy/pasted the example from the README. There was an error in this were the code tries to access report.extra before it's set, which I've now fixed. I've also simplified the example because it was relying on a TestSetup having a Selenium object."}}