Add test when using native strings with non-ascii chars
This commit is contained in:
@@ -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: ☺"])
|
||||
|
||||
Reference in New Issue
Block a user