Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Occure INTERNALERROR UnicodeDecodeError when test function decorated with allure.step and in function using assertpy for compare binary data which not equals #186

Closed
3 tasks
RockBomber opened this issue Dec 10, 2017 · 0 comments

Comments

@RockBomber
Copy link
Contributor

RockBomber commented Dec 10, 2017

I'm submitting a ...

  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.

What is the current behavior?

Occure INTERNALERROR UnicodeDecodeError when test function decorated with allure.step and in function using assertpy for compare binary data which not equals.

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

First install assertpy package.

Create file test_assertpy_error.py with content:

# -*- coding: utf-8 -*-

from assertpy import assert_that
import allure

@allure.step(u'Функция 1')
def test_1():
    assert_that('0\x82').is_equal_to(1)

Then run it: pytest test_assertpy_error.py --alluredir ./areport_assertpy

You will got an error:

$ pytest test_assertpy_error.py --alluredir ./areport_assertpy
================================================================================= test session starts =================================================================================
platform linux2 -- Python 2.7.14, pytest-3.3.1, py-1.5.2, pluggy-0.6.0
rootdir: /home/bomber/Dropbox/Work/Git/PyTestError, inifile: pytest.ini
plugins: allure-pytest-2.2.4b1
collected 1 item                                                                                                                                                                      

test_assertpy_error.py F                                                                                                                                                        [100%]
INTERNALERROR> Traceback (most recent call last):
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/_pytest/main.py", line 103, in wrap_session
INTERNALERROR>     session.exitstatus = doit(config, session) or 0
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/_pytest/main.py", line 141, in _main
INTERNALERROR>     config.hook.pytest_runtestloop(session=session)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 77, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/_pytest/main.py", line 164, in pytest_runtestloop
INTERNALERROR>     item.config.hook.pytest_runtest_protocol(item=item, nextitem=nextitem)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 196, in _multicall
INTERNALERROR>     gen.send(outcome)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/allure_pytest/listener.py", line 94, in pytest_runtest_protocol
INTERNALERROR>     self.allure_logger.close_test(uuid)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/allure_commons/reporter.py", line 73, in close_test
INTERNALERROR>     plugin_manager.hook.report_result(result=test_case)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 617, in __call__
INTERNALERROR>     return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 222, in _hookexec
INTERNALERROR>     return self._inner_hookexec(hook, methods, kwargs)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/__init__.py", line 216, in <lambda>
INTERNALERROR>     firstresult=hook.spec_opts.get('firstresult'),
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 201, in _multicall
INTERNALERROR>     return outcome.get_result()
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 77, in get_result
INTERNALERROR>     _reraise(*ex)  # noqa
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/pluggy/callers.py", line 180, in _multicall
INTERNALERROR>     res = hook_impl.function(*args)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/allure_commons/logger.py", line 34, in report_result
INTERNALERROR>     self._report_item(result)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/local/lib/python2.7/site-packages/allure_commons/logger.py", line 28, in _report_item
INTERNALERROR>     json_file.write(unicode(json.dumps(data, indent=indent, ensure_ascii=False, encoding='utf8')))
INTERNALERROR>   File "/usr/lib/python2.7/json/__init__.py", line 251, in dumps
INTERNALERROR>     sort_keys=sort_keys, **kw).encode(obj)
INTERNALERROR>   File "/usr/lib/python2.7/json/encoder.py", line 207, in encode
INTERNALERROR>     chunks = self.iterencode(o, _one_shot=True)
INTERNALERROR>   File "/usr/lib/python2.7/json/encoder.py", line 270, in iterencode
INTERNALERROR>     return _iterencode(o, 0)
INTERNALERROR>   File "/usr/lib/python2.7/json/encoder.py", line 233, in _encoder
INTERNALERROR>     o = o.decode(_encoding)
INTERNALERROR>   File "/home/bomber/.virtualenvs/pytest33/lib/python2.7/encodings/utf_8.py", line 16, in decode
INTERNALERROR>     return codecs.utf_8_decode(input, errors, True)
INTERNALERROR> UnicodeDecodeError: 'utf8' codec can't decode byte 0x82 in position 27: invalid start byte

============================================================================== 1 failed in 0.03 seconds ===============================================================================

What is the expected behavior?

Error should not occur. Allure must handle such case.

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant