Closed micheletest closed 7 years ago
Interesting.. it looks like your test is being timed out by pytest-timeout. Perhaps that is causing an issue with pytest-html. I had hoped that all the encoding issues were fixed, but they keep popping up! If you're able to create a test for this that would be really helpful.
Agree, this seems to do with pytest-timeout. I can replicate this locally when it times out, but only in that case. What fixes the issue for me is to remove the if PY3 in data_uri (line 74 of plugin.py) and let it encode/decode the content in all cases.
I'm having trouble running the tests which I want to do before adding a new one. Are there preconditions to get going? Just doing pytest doesn't work for me. - /Library/Python/2.7/site-packages/_pytest/config.py:1280: AttributeError: 'NoneType' object has no attribute 'option'
I'm having trouble running the tests which I want to do before adding a new one. Are there preconditions to get going? Just doing pytest doesn't work for me.
The tests are run using tox, so you'll need to pip install that first. This manages the Python versions and virtual environments for you. For example, to run the tests against the latest version of Python and pytest, run: tox -e py36-pytest30
, or for Python 2.7: tox -e py27-pytest30
I have a potential fix in #108. Please give that a try and let me know if it's working for you.
Just marked on the PR, this fixed the issue for me. Thanks for looking into it.
Thanks @micheletest! I've merged and tagged, so v1.14.2 should be available soon!
i am still getting below mentioned error
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\main.py", line 185, in wrap_session
INTERNALERROR> session.exitstatus = doit(config, session) or 0
INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\main.py", line 225, in _main
INTERNALERROR> config.hook.pytest_runtestloop(session=session)
INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\hooks.py", line 284, in call
INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs)
INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 67, in _hookexec
INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 61, in
i am still getting below mentioned error
INTERNALERROR> Traceback (most recent call last): INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\main.py", line 185, in wrap_session INTERNALERROR> session.exitstatus = doit(config, session) or 0 INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\main.py", line 225, in _main INTERNALERROR> config.hook.pytest_runtestloop(session=session) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\hooks.py", line 284, in call INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 67, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 61, in INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(args) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\main.py", line 246, in pytest_runtestloop INTERNALERROR> item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\hooks.py", line 284, in call INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 67, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 61, in INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(args) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\runner.py", line 76, in pytest_runtest_protocol INTERNALERROR> runtestprotocol(item, nextitem=nextitem) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\runner.py", line 91, in runtestprotocol INTERNALERROR> reports.append(call_and_report(item, "call", log)) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages_pytest\runner.py", line 175, in call_and_report INTERNALERROR> hook.pytest_runtest_logreport(report=report) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\hooks.py", line 284, in call INTERNALERROR> return self._hookexec(self, self.get_hookimpls(), kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 67, in _hookexec INTERNALERROR> return self._inner_hookexec(hook, methods, kwargs) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\manager.py", line 61, in INTERNALERROR> firstresult=hook.spec.opts.get("firstresult") if hook.spec else False, INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 208, in _multicall INTERNALERROR> return outcome.get_result() INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 80, in get_result INTERNALERROR> raise ex[1].with_traceback(ex[2]) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pluggy\callers.py", line 187, in _multicall INTERNALERROR> res = hook_impl.function(*args) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\pytest_plugin.py", line 319, in pytest_runtest_logreport INTERNALERROR> self.report_test_output(report, test_id) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\pytest_plugin.py", line 236, in report_test_output INTERNALERROR> dump_test_stdout(self.teamcity, test_id, test_id, data) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\common.py", line 73, in dump_test_stdout INTERNALERROR> messages.testStdOut(test_id, chunk, flowId=flow_id) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\messages.py", line 167, in testStdOut INTERNALERROR> self.message('testStdOut', name=testName, out=out, flowId=flowId) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm_jb_runner_tools.py", line 113, in message INTERNALERROR> _old_service_messages.message(self, messageName, **properties) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\messages.py", line 81, in message INTERNALERROR> self.output.write(self.encode(message)) INTERNALERROR> File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\helpers\pycharm\teamcity\messages.py", line 48, in encode INTERNALERROR> value = value.encode(self.encoding) INTERNALERROR> File "C:\Users\cbiradar\AppData\Local\Programs\Python\Python37-32\lib\encodings\cp1252.py", line 12, in encode INTERNALERROR> return codecs.charmap_encode(input,errors,encoding_table) INTERNALERROR> UnicodeEncodeError: 'charmap' codec can't encode character '\ufffd' in position 52359: character maps to
Did you find a solve?
@rafi4135 Try installing pytest-dev version 4.0.0rc4. This fixed this issue for myself.
I just tried to update to the latest pytest html and I'm getting an encoding error. The line referred to isn't encoded that I see, so perhaps that needs an update. I can try to look more into this later.