@@ -458,28 +458,29 @@ def test_assume_ascii(self, testdir):
458
458
459
459
@pytest .mark .skipif ("sys.version_info[0] >= 3" )
460
460
def test_detect_coding_cookie (self , testdir ):
461
- testdir .tmpdir .join ("test_cookie.py" ).write ("""# -*- coding: utf-8 -*-
462
- u"St\xc3 \xa4 d"
463
- def test_rewritten():
464
- assert "@py_builtins" in globals()""" , "wb" )
461
+ testdir .makepyfile (test_cookie = u"""
462
+ # -*- coding: utf-8 -*-
463
+ u"St\xc3 \xa4 d"
464
+ def test_rewritten():
465
+ assert "@py_builtins" in globals()""" .encode ('utf-8' ))
465
466
assert testdir .runpytest ().ret == 0
466
467
467
468
@pytest .mark .skipif ("sys.version_info[0] >= 3" )
468
469
def test_detect_coding_cookie_second_line (self , testdir ):
469
- testdir .tmpdir . join ( " test_cookie.py" ). write ( """#!/usr/bin/env python
470
- # -*- coding: utf-8 -*-
471
- u"St\xc3 \xa4 d"
472
- def test_rewritten():
473
- assert "@py_builtins" in globals()""" , "wb" )
470
+ testdir .makepyfile ( test_cookie = u"""
471
+ # -*- coding: utf-8 -*-
472
+ u"St\xc3 \xa4 d"
473
+ def test_rewritten():
474
+ assert "@py_builtins" in globals()""" . encode ( 'utf-8' ) )
474
475
assert testdir .runpytest ().ret == 0
475
476
476
477
@pytest .mark .skipif ("sys.version_info[0] >= 3" )
477
478
def test_detect_coding_cookie_crlf (self , testdir ):
478
- testdir .tmpdir . join ( " test_cookie.py" ). write ( """#!/usr/bin/env python
479
- # -*- coding: utf-8 -*-
480
- u"St\xc3 \xa4 d"
481
- def test_rewritten():
482
- assert "@py_builtins" in globals()""" .replace ( " \n " , " \r \n " ), "wb" )
479
+ testdir .makepyfile ( test_cookie = u"""
480
+ # -*- coding: utf-8 -*-
481
+ u"St\xc3 \xa4 d"
482
+ def test_rewritten():
483
+ assert "@py_builtins" in globals()""" .encode ( 'utf-8' ) )
483
484
assert testdir .runpytest ().ret == 0
484
485
485
486
def test_sys_meta_path_munged (self , testdir ):
0 commit comments