pytest-dev / pytest-dev/pytest-html
_max_asset_filename_length of BaseReport does not account for prefixed 'assets/'
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 779
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
The maximum file size is used here to truncate the asset name
https://github.com/pytest-dev/pytest-html/blob/4b88ee41bdbb5666b31dffd366608f735565b329/src/pytest_html/basereport.py#L50
and used together here with 'assets' to build a write destination for media assets
https://github.com/pytest-dev/pytest-html/blob/4b88ee41bdbb5666b31dffd366608f735565b329/src/pytest_html/report.py#L39
on windows systems with a 256 character path length this will cause the write to silently fail and the following read when creating the report to not find the given asset.
conftest.py
@pytest.mark.hookwrapper
def pytest_runtest_makereport(item, call):
_ = call
outcome = yield
report = outcome.get_result()
extra = getattr(report, 'extra', list())
report.extra = extra
browser: WebDriver = item.funcargs.get('browser', None)
screenshot = browser.get_screenshot_as_base64()
extra.append(pytest_html.extras.png(screenshot))
test_stuff.py
def test_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa(browser):
assert False
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked calculations in src/pytest_html/basereport.py and src/pytest_html/report.py, then run the provided long-test-name screenshot reproduction on Windows or with an equivalent path-length limit. Done means media assets still write and are read when the generated report uses the prefixed assets/ destination.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100