@pytest.mark.parametrize('str_prefix', ['u', ''])
def test_pytest_fail_notrace_non_ascii(testdir, str_prefix):
 testdir.makepyfile((u"\n        # coding: utf-8\n        import pytest\n\n        def test_hello():\n            pytest.fail(%s'oh oh: \u263a', pytrace=False)\n    " % str_prefix))
 result = testdir.runpytest()
 if (sys.version_info[0] >= 3):
  result.stdout.fnmatch_lines(['*test_hello*', 'oh oh: \xe2\x98\xba'])
 else:
  result.stdout.fnmatch_lines(['*test_hello*', 'oh oh: *'])
 assert ('def test_hello' not in result.stdout.str())

@ pytest . mark . parametrize ( 'str_prefix' , [ 'u' , '' ] ) def test_pytest_fail_notrace_non_ascii ( testdir , str_prefix ) : testdir . makepyfile ( ( u"\n        # coding: utf-8\n        import pytest\n\n        def test_hello():\n            pytest.fail(%s'oh oh: \u263a', pytrace=False)\n    " % str_prefix ) ) result = testdir . runpytest ( ) if ( sys . version_info [ 0 ] >= 3 ) : result . stdout . fnmatch_lines ( [ '*test_hello*' , 'oh oh: \xe2\x98\xba' ] ) else : result . stdout . fnmatch_lines ( [ '*test_hello*' , 'oh oh: *' ] ) assert ( 'def test_hello' not in result . stdout . str ( ) )
fix pytest .