Description
Hi @BeyondEvil this is the method that I'm using to create report, as you can see there is extra = getattr(report, "extra", []) that I'm using to add extra infos in report like url, screenshoots etc. The issue that is returned you can find under the second line:
@pytest.hookimpl(hookwrapper=True)
def pytest_runtest_makereport(item, call):
pytest_html = item.config.pluginmanager.getplugin("html")
outcome = yield
report = outcome.get_result()
setattr(report, "duration_formatter", "%H:%M:%S.%f")
extra = getattr(report, "extra", [])
test_fn = item.obj
docstring = getattr(test_fn, 'doc')
if docstring:
report.nodeid = docstring
if report.when == "call":
# report.nodeid = item.name
extra.append(pytest_html.extras.url(TestData.BASE_URL))
xfail = hasattr(report, "wasxfail")
if (report.skipped and xfail) or (report.failed and not xfail):
# Get the directory where the Report is saved
try:
reports_directory = os.path.dirname(item.config.option.htmlpath)
except TypeError:
if "tests" in os.path.abspath(os.curdir):
os.chdir("..")
reports_directory = os.path.abspath(os.curdir) + "/reports"
# Set the name of the screenshot [failed_test_name] + [current_date] + [type of image]
scr_file_name =
os.environ.get('PYTEST_CURRENT_TEST').replace('(call)', '').split(':')[-1].split('__')[0]
+ datetime.now().strftime("%d-%m-%Y-%H-%M") + ".png"
# Set the directory where the screenshot should be saved
destination_file = os.path.join(reports_directory, scr_file_name)
# Take the actual screenshot
driver.save_screenshot(destination_file)
if scr_file_name:
html = '
'onclick="window.open(this.src)" align="right"/>
extra.append(pytest_html.extras.html(html))
report.extra = extra
INTERNALERROR> extra.append(pytest_html.extras.url(TestData.BASE_URL))
INTERNALERROR> AttributeError: 'NoneType' object has no attribute 'extras'
Originally posted by @BleronHasani01 in #607 (comment)