8
8
9
9
IS_PYPY = '__pypy__' in sys .builtin_module_names
10
10
11
+ _TEXT_KWARGS = {"text" : True , "encoding" : "utf-8" } # For subprocess.run
12
+
11
13
12
14
def win_sr (env ):
13
15
"""
@@ -24,7 +26,7 @@ def win_sr(env):
24
26
def find_distutils (venv , imports = 'distutils' , env = None , ** kwargs ):
25
27
py_cmd = 'import {imports}; print(distutils.__file__)' .format (** locals ())
26
28
cmd = ['python' , '-c' , py_cmd ]
27
- return venv .run (cmd , env = win_sr (env ), text = True , ** kwargs )
29
+ return venv .run (cmd , env = win_sr (env ), ** _TEXT_KWARGS , ** kwargs )
28
30
29
31
30
32
def count_meta_path (venv , env = None ):
@@ -36,7 +38,7 @@ def count_meta_path(venv, env=None):
36
38
"""
37
39
)
38
40
cmd = ['python' , '-c' , py_cmd ]
39
- return int (venv .run (cmd , env = win_sr (env ), text = True ))
41
+ return int (venv .run (cmd , env = win_sr (env ), ** _TEXT_KWARGS ))
40
42
41
43
42
44
skip_without_stdlib_distutils = pytest .mark .skipif (
@@ -82,7 +84,7 @@ def test_pip_import(venv):
82
84
Regression test for #3002.
83
85
"""
84
86
cmd = ['python' , '-c' , 'import pip' ]
85
- venv .run (cmd , text = True )
87
+ venv .run (cmd , ** _TEXT_KWARGS )
86
88
87
89
88
90
def test_distutils_has_origin ():
@@ -130,7 +132,7 @@ def test_modules_are_not_duplicated_on_import(
130
132
env = dict (SETUPTOOLS_USE_DISTUTILS = distutils_version )
131
133
script = ENSURE_IMPORTS_ARE_NOT_DUPLICATED .format (imported_module = imported_module )
132
134
cmd = ['python' , '-c' , script ]
133
- output = venv .run (cmd , env = win_sr (env ), text = True ).strip ()
135
+ output = venv .run (cmd , env = win_sr (env ), ** _TEXT_KWARGS ).strip ()
134
136
assert output == "success"
135
137
136
138
@@ -154,5 +156,5 @@ def test_modules_are_not_duplicated_on_import(
154
156
def test_log_module_is_not_duplicated_on_import (distutils_version , tmpdir_cwd , venv ):
155
157
env = dict (SETUPTOOLS_USE_DISTUTILS = distutils_version )
156
158
cmd = ['python' , '-c' , ENSURE_LOG_IMPORT_IS_NOT_DUPLICATED ]
157
- output = venv .run (cmd , env = win_sr (env ), text = True ).strip ()
159
+ output = venv .run (cmd , env = win_sr (env ), ** _TEXT_KWARGS ).strip ()
158
160
assert output == "success"
0 commit comments