Skip to content

Why don't I see attachments in the run report?

Ensure that the add_artifacts method is called with a flat list of artifact URLs.

  1. Modify the Code
    Update your code to pass the list of artifact URLs directly to the add_artifacts method without nesting it in another list.

    def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo) -> None:
    if call.when == 'call' and call.excinfo is not None:
    print(f'Current test failed: {item.name}')
    artifact_urls: list[str] = []
    print(f'Current log dir: {Logger.dir}')
    for file in Logger.dir.glob('*.*'):
    print(f'{file=}')
    artifact_urls.append(pytest.testomatio.upload_file(file.resolve(), file))
    pytest.testomatio.add_artifacts(item, artifact_urls)
  2. Check the Loop Placement
    Ensure that the add_artifacts method is called outside of any loop to prevent duplication of artifacts in the report.

  • The add_artifacts method does not work with nested lists. Ensure that the list of URLs is not nested when passed to the method.