pytest-dev / pytest-html

Plugin for generating HTML reports for pytest results
Other
704 stars 235 forks source link

UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 484025: character maps to <undefined> #744

Open Dineshr08 opened 1 year ago

Dineshr08 commented 1 year ago

Getting UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 484025: character maps to intermittently. When most of the testcase failed, getting above error while generating html report FFFF.FF.F..FFFFFF.FF.FFFFF.FFFFFFF.FF.FFF.FFFFFFFFFFF.FF..F.FFF [100%]Traceback (most recent call last): File "c:\program files\python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\program files\python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Program Files\Python37\Scripts\py.test.exe__main.py", line 9, in sys.exit(console_main()) File "c:\program files\python37\lib\site-packages_pytest\config__init.py", line 189, in console_main code = main() File "c:\program files\python37\lib\site-packages_pytest\config\init__.py", line 167, in main config=config File "c:\program files\python37\lib\site-packages\pluggy_hooks.py", line 433, in call return self._hookexec(self.name, self._hookimpls, kwargs, firstresult) File "c:\program files\python37\lib\site-packages\pluggy_manager.py", line 112, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "c:\program files\python37\lib\site-packages\pluggy_callers.py", line 116, in _multicall raise exception.with_traceback(exception.traceback) File "c:\program files\python37\lib\site-packages\pluggy_callers.py", line 80, in _multicall res = hook_impl.function(*args) File "c:\program files\python37\lib\site-packages_pytest\main.py", line 317, in pytest_cmdline_main return wrap_session(config, _main) File "c:\program files\python37\lib\site-packages_pytest\main.py", line 306, in wrap_session session=session, exitstatus=session.exitstatus File "c:\program files\python37\lib\site-packages\pluggy_hooks.py", line 433, in call return self._hookexec(self.name, self._hookimpls, kwargs, firstresult) File "c:\program files\python37\lib\site-packages\pluggy_manager.py", line 112, in _hookexec return self._inner_hookexec(hook_name, methods, kwargs, firstresult) File "c:\program files\python37\lib\site-packages\pluggy_callers.py", line 133, in _multicall teardown[0].send(outcome) File "c:\program files\python37\lib\site-packages_pytest\terminal.py", line 857, in pytest_sessionfinish outcome.get_result() File "c:\program files\python37\lib\site-packages\pluggy_result.py", line 108, in get_result raise exc.with_traceback(exc.traceback__) File "c:\program files\python37\lib\site-packages\pluggy_callers.py", line 80, in _multicall res = hook_impl.function(*args) File "c:\program files\python37\lib\site-packages\pytest_html\html_report.py", line 333, in pytest_sessionfinish self._save_report(report_content) File "c:\program files\python37\lib\site-packages\pytest_html\html_report.py", line 259, in _save_report self.logfile.write_text(report_content) File "c:\program files\python37\lib\pathlib.py", line 1226, in write_text return f.write(data) File "c:\program files\python37\lib\encodings\cp1252.py", line 19, in encode return codecs.charmap_encode(input,self.errors,encoding_table)[0] UnicodeEncodeError: 'charmap' codec can't encode character '\u2713' in position 484025: character maps to

BeyondEvil commented 1 year ago

Could you create a minimal reproducible example/test-case?