JetBrains / teamcity-messages

Python Unit Test Reporting to TeamCity
https://pypi.python.org/pypi/teamcity-messages
Apache License 2.0
136 stars 81 forks source link

Playwrigth test execution failed on TeamCity #253

Open algot opened 2 years ago

algot commented 2 years ago

I created a simple project with playwright and pytest to reproduce an error I got reproduced on my production project

You may use it to reproduce it in your side https://github.com/algot/python_playwright_issue

Previously I used playwright 1.12 and my tests worked well but after the update to 1.13 TeamCity plugin teamcity-messages caused an error in the attempt to start the first UI test

......
[23:48:55]i:         [Python run in Venv] type "C:\BuildAgent\temp\buildTmp\script_1627418927274_544fc899-5fb9-42df-8042-073445d22493}7633413323482313437.cmd"
[23:48:55]i:         [Python run in Venv] call ".\.venv\Scripts\activate"
[23:48:55]i:         [Python run in Venv] REM TeamCity Message: Python command
[23:48:55] :         [Python run in Venv] python -m pytest
[23:48:55] :         [Python run in Venv] ============================= test session starts =============================
[23:48:55] :         [Python run in Venv] platform win32 -- Python 3.9.5, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 -- C:\BuildAgent\work\813b7ce7214a4f99\.venv\Scripts\python.exe
[23:48:55] :         [Python run in Venv] cachedir: .pytest_cache
[23:48:55] :         [Python run in Venv] rootdir: C:\BuildAgent\work\813b7ce7214a4f99, configfile: pytest.ini
[23:48:55] :         [Python run in Venv] plugins: teamcity-messages-1.29
[23:48:55] :         [Python run in Venv] collecting ... 
[23:48:55]i:         [Python run in Venv] ##teamcity[testCount timestamp='2021-07-27T22:48:55.599' count='1']
[23:48:55] :         [Python run in Venv] collected 1 item
[23:48:55] :         [Python run in Venv] 
[23:48:55] :         [Python run in Venv] test_google.py::TestGoogle::test_google_title
[23:48:55] :             [Step 1/1] test_google.TestGoogle.test_google_title (5s)
[23:48:56] :         [Python run in Venv] ERROR
[23:48:56] :         [Python run in Venv] INTERNALERROR> Traceback (most recent call last):
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\main.py", line 269, in wrap_session
[23:48:56] :         [Python run in Venv] INTERNALERROR>     session.exitstatus = doit(config, session) or 0
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\main.py", line 323, in _main
[23:48:56] :         [Python run in Venv] INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return outcome.get_result()
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 80, in get_result
[23:48:56] :         [Python run in Venv] INTERNALERROR>     raise ex[1].with_traceback(ex[2])
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     res = hook_impl.function(*args)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\main.py", line 348, in pytest_runtestloop
[23:48:56] :         [Python run in Venv] INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return outcome.get_result()
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 80, in get_result
[23:48:56] :         [Python run in Venv] INTERNALERROR>     raise ex[1].with_traceback(ex[2])
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     res = hook_impl.function(*args)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\runner.py", line 109, in pytest_runtest_protocol
[23:48:56] :         [Python run in Venv] INTERNALERROR>     runtestprotocol(item, nextitem=nextitem)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\runner.py", line 120, in runtestprotocol
[23:48:56] :         [Python run in Venv] INTERNALERROR>     rep = call_and_report(item, "setup", log)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\_pytest\runner.py", line 219, in call_and_report
[23:48:56] :         [Python run in Venv] INTERNALERROR>     hook.pytest_runtest_logreport(report=report)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\hooks.py", line 286, in __call__
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._hookexec(self, self.get_hookimpls(), kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 93, in _hookexec
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\manager.py", line 84, in <lambda>
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self._inner_hookexec = lambda hook, methods, kwargs: hook.multicall(
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 208, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return outcome.get_result()
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 80, in get_result
[23:48:56] :         [Python run in Venv] INTERNALERROR>     raise ex[1].with_traceback(ex[2])
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\pluggy\callers.py", line 187, in _multicall
[23:48:56] :         [Python run in Venv] INTERNALERROR>     res = hook_impl.function(*args)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\teamcity\pytest_plugin.py", line 363, in pytest_runtest_logreport
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self.report_test_failure(test_id, report, message="test setup failed", report_output=False)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\teamcity\pytest_plugin.py", line 310, in report_test_failure
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self.teamcity.testFailed(test_id, message, str(report.longrepr), flowId=test_id)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\teamcity\messages.py", line 174, in testFailed
[23:48:56] :         [Python run in Venv] INTERNALERROR>     self.message('testFailed', name=testName, message=message, details=details, flowId=flowId)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\teamcity\messages.py", line 101**, in message
[23:48:56] :         [Python run in Venv] INTERNALERROR>     retry_on_EAGAIN(self.output.write)(self.encode(message))
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\BuildAgent\work\813b7ce7214a4f99\.venv\lib\site-packages\teamcity\messages.py", line 68, in encode
[23:48:56] :         [Python run in Venv] INTERNALERROR>     value = value.encode(self.encoding)
[23:48:56] :         [Python run in Venv] INTERNALERROR>   File "C:\Users\ago\AppData\Local\Programs\Python\Python39\lib\encodings\cp1252.py", line 12, in encode
[23:48:56] :         [Python run in Venv] INTERNALERROR>     return codecs.charmap_encode(input,errors,encoding_table)
[23:48:56] :         [Python run in Venv] INTERNALERROR> UnicodeEncodeError: 'charmap' codec can't encode characters in position 602-676: character maps to <undefined>
[23:48:56] :         [Python run in Venv] 
[23:48:56] :         [Python run in Venv] ============================== 1 error in 0.77s ===============================

My TeamCity project is used the default pytest runner as buildstep without any extra custom parameters.

Downgrading playwright to the previous version fixed an issue

Please assist