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.
-
Modify the Code
Update your code to pass the list of artifact URLs directly to theadd_artifactsmethod 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) -
Check the Loop Placement
Ensure that theadd_artifactsmethod is called outside of any loop to prevent duplication of artifacts in the report.
- The
add_artifactsmethod does not work with nested lists. Ensure that the list of URLs is not nested when passed to the method.