pytest-dev / pytest-dev/pytest-html
pytest-html 3.2.0 error on report generation on Gitlab-CI
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 779
- Forks
- 260
- PR merge metrics
- No merged PRs in 30d
Description
pytest-html 3.2.0 error on report generation on Gitlab-CI
Observed: error on report generation
NB: we have downgraded to version 3.1.1 and everything works well
I think the problem is in: Explicitly add py.xml dependency.
And the issue is the same as: https://github.com/microsoft/pylance-release/issues/2357
Log:
File "/Users/mobile-ci/.pyenv/versions/3.9.16/bin/pytest", line 8, in
sys.exit(console_main())
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/config/init.py", line 190, in console_main
code = main()
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/config/init.py", line 167, in main
ret: Union[ExitCode, int] = config.hook.pytest_cmdline_main(
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in call
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 60, in _multicall
return outcome.get_result()
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/main.py", line 317, in pytest_cmdline_main
return wrap_session(config, _main)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/main.py", line 305, in wrap_session
config.hook.pytest_sessionfinish(
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_hooks.py", line 265, in call
return self._hookexec(self.name, self.get_hookimpls(), kwargs, firstresult)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_manager.py", line 80, in _hookexec
return self._inner_hookexec(hook_name, methods, kwargs, firstresult)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 55, in _multicall
gen.send(outcome)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/_pytest/terminal.py", line 808, in pytest_sessionfinish
outcome.get_result()
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_result.py", line 60, in get_result
raise ex[1].with_traceback(ex[2])
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pluggy/_callers.py", line 39, in _multicall
res = hook_impl.function(*args)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pytest_html/html_report.py", line 332, in pytest_sessionfinish
report_content = self._generate_report(session)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/pytest_html/html_report.py", line 206, in _generate_report
unicode_doc = "\n{}".format(doc.unicode(indent=2))
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 69, in unicode
HtmlVisitor(l.append, indent, shortempty=False).visit(self)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit
visitmethod(node)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag
self.visit(x)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit
visitmethod(node)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag
self.visit(x)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit
visitmethod(node)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 160, in Tag
self.visit(x)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 128, in visit
visitmethod(node)
File "/Users/mobile-ci/.pyenv/versions/3.9.16/lib/python3.9/site-packages/py/_xmlgen.py", line 140, in list
assert id(obj) not in self.visited
AssertionError: assert 4500331456 not in {4500220800: 1, 4500222816: 1, 4500259040: 1, 4500259280: 1, ...}
- where 4500331456 = id([<'span' tag object 4500315888>, <'span' tag object 4500315728>, <'span' tag object 4500315408>, <'span' tag object 4500313728>])
- and {4500220800: 1, 4500222816: 1, 4500259040: 1, 4500259280: 1, ...} = <py._xmlgen.HtmlVisitor object at 0x10c3bbb20>.visited
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 by reproducing report generation with pytest-html 3.2.0 and the Python 3.9 environment shown in the traceback. Inspect pytest_html/html_report.py and py/_xmlgen.py around _generate_report and HtmlVisitor.list, then compare against version 3.1.1. Done means HTML generation succeeds on GitLab CI without the downgrade, with a regression test covering the failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- testing-qa
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100