summaryrefslogtreecommitdiff
path: root/tests/helpers.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-05-01 13:02:31 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-05-01 13:30:39 -0400
commit9df434550a499c16e9fd26cfb9627837bfdc02a5 (patch)
tree5619ea3c3bec05d04363a66ced9c7ebffcefb1df /tests/helpers.py
parent3fe17c1f2244c07cf9d0f9e3609392c2ad441db1 (diff)
downloadpython-coveragepy-git-9df434550a499c16e9fd26cfb9627837bfdc02a5.tar.gz
refactor: remove code explicitly choosing between py2 and py3
Diffstat (limited to 'tests/helpers.py')
-rw-r--r--tests/helpers.py11
1 files changed, 1 insertions, 10 deletions
diff --git a/tests/helpers.py b/tests/helpers.py
index daed3d1a..93583b8b 100644
--- a/tests/helpers.py
+++ b/tests/helpers.py
@@ -10,13 +10,10 @@ import os
import os.path
import re
import subprocess
-import sys
import textwrap
import mock
-from coverage import env
-from coverage.backward import unicode_class
from coverage.misc import output_encoding
@@ -26,9 +23,6 @@ def run_command(cmd):
Returns the exit status code and the combined stdout and stderr.
"""
- if env.PY2 and isinstance(cmd, unicode_class):
- cmd = cmd.encode(sys.getfilesystemencoding())
-
# In some strange cases (PyPy3 in a virtualenv!?) the stdout encoding of
# the subprocess is set incorrectly to ascii. Use an environment variable
# to force the encoding to be the same as ours.
@@ -76,10 +70,7 @@ def make_file(filename, text="", bytes=b"", newline=None):
text = textwrap.dedent(text)
if newline:
text = text.replace("\n", newline)
- if env.PY3:
- data = text.encode('utf8')
- else:
- data = text
+ data = text.encode('utf8')
# Make sure the directories are available.
dirs, _ = os.path.split(filename)