Closed
Description
OS: OS X 10.11.6 (also present on Ubuntu 14.04)
Python version: 2.7.12
pytest version: 3.0.4
Output of pip list
:
pip (9.0.1)
py (1.4.31)
pytest (3.0.4)
setuptools (30.0.0)
wheel (0.30.0a0)
This code:
import pytest
def test_foo():
assert [3] == [pytest.approx(4)]
produces the below output. It looks like the detailed diff can't render due to the ± character in the __repr__
of pytest.approx
.
(venv) ➜ /tmp py.test pytest_broken.py
============================= test session starts ==============================
platform darwin -- Python 2.7.12, pytest-3.0.4, py-1.4.31, pluggy-0.4.0
rootdir: /private/tmp, inifile:
plugins: cov-2.2.1, mock-0.11.0
collected 1 items
pytest_broken.py F
=================================== FAILURES ===================================
___________________________________ test_foo ___________________________________
def test_foo():
> assert [3] == [pytest.approx(4)]
E assert [3] == [4 ± 4.0e-06]
E (pytest_assertion plugin: representation of details failed. Probably an object has a faulty __repr__.)
E /usr/local/lib/python2.7/site-packages/_pytest/assertion/util.py:228: UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 2: ordinal not in range(128)
pytest_broken.py:4: AssertionError
============================ pytest-warning summary ============================
WC1 None pytest_funcarg__cov: declaring fixtures using "pytest_funcarg__" prefix is deprecated and scheduled to be removed in pytest 4.0. Please remove the prefix and use the @pytest.fixture decorator instead.
================= 1 failed, 1 pytest-warnings in 0.03 seconds ==================