Add test when using native strings with non-ascii chars

This commit is contained in:
Bruno Oliveira
2016-03-05 19:34:15 -03:00
parent 24d3e01548
commit 5d4703852e
2 changed files with 10 additions and 4 deletions
+6 -3
View File
@@ -440,16 +440,19 @@ def test_pytest_fail_notrace(testdir):
assert 'def teardown_function' not in result.stdout.str()
def test_pytest_fail_notrace_unicode(testdir):
@pytest.mark.parametrize('str_prefix', ['u', ''])
def test_pytest_fail_notrace_non_ascii(testdir, str_prefix):
"""Fix pytest.fail with pytrace=False with non-ascii characters (#1178).
This tests with native and unicode strings containing non-ascii chars.
"""
testdir.makepyfile(u"""
# coding: utf-8
import pytest
def test_hello():
pytest.fail(u'oh oh: ☺', pytrace=False)
""")
pytest.fail(%s'oh oh: ☺', pytrace=False)
""" % str_prefix)
result = testdir.runpytest()
if sys.version_info[0] >= 3:
result.stdout.fnmatch_lines(['*test_hello*', "oh oh: ☺"])