aboutsummaryrefslogtreecommitdiffstats
path: root/setuptools/tests/test_distutils_adoption.py
diff options
context:
space:
mode:
Diffstat (limited to 'setuptools/tests/test_distutils_adoption.py')
-rw-r--r--setuptools/tests/test_distutils_adoption.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/setuptools/tests/test_distutils_adoption.py b/setuptools/tests/test_distutils_adoption.py
index f4c7072d..a945a69f 100644
--- a/setuptools/tests/test_distutils_adoption.py
+++ b/setuptools/tests/test_distutils_adoption.py
@@ -1,7 +1,18 @@
import os
+import sys
+import functools
+
import pytest
+def popen_text(call):
+ """
+ Augment the Popen call with the parameters to ensure unicode text.
+ """
+ return functools.partial(call, universal_newlines=True) \
+ if sys.version_info < (3, 7) else functools.partial(call, text=True)
+
+
@pytest.fixture
def env(virtualenv):
virtualenv.run(['pip', 'uninstall', '-y', 'setuptools'])
@@ -12,7 +23,7 @@ def env(virtualenv):
def find_distutils(env, imports='distutils'):
py_cmd = 'import {imports}; print(distutils.__file__)'.format(**locals())
cmd = ['python', '-c', py_cmd]
- return env.run(cmd, capture=True, text=True)
+ return popen_text(env.run)(cmd, capture=True)
def test_distutils_stdlib(env):