summaryrefslogtreecommitdiff
path: root/coverage
diff options
context:
space:
mode:
Diffstat (limited to 'coverage')
-rw-r--r--coverage/config.py4
-rw-r--r--coverage/execfile.py9
-rw-r--r--coverage/multiproc.py6
3 files changed, 10 insertions, 9 deletions
diff --git a/coverage/config.py b/coverage/config.py
index 285cb21..effa382 100644
--- a/coverage/config.py
+++ b/coverage/config.py
@@ -6,8 +6,8 @@
import collections
import os
import re
-import sys
+from coverage import env
from coverage.backward import configparser, iitems, string_class
from coverage.misc import contract, CoverageException, isolate_module
@@ -33,7 +33,7 @@ class HandyConfigParser(configparser.RawConfigParser):
def read(self, filenames):
"""Read a file name as UTF-8 configuration data."""
kwargs = {}
- if sys.version_info >= (3, 2):
+ if env.PYVERSION >= (3, 2):
kwargs['encoding'] = "utf-8"
return configparser.RawConfigParser.read(self, filenames, **kwargs)
diff --git a/coverage/execfile.py b/coverage/execfile.py
index a72cb71..68417f8 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -9,6 +9,7 @@ import struct
import sys
import types
+from coverage import env
from coverage.backward import BUILTINS
from coverage.backward import PYC_MAGIC_NUMBER, imp, importlib_util_find_spec
from coverage.misc import CoverageException, ExceptionDuringRun, NoCode, NoSource, isolate_module
@@ -115,7 +116,7 @@ def run_python_module(modulename, args):
# used to be an empty string (meaning the current directory). It changed
# to be the actual path to the current directory, so that os.chdir wouldn't
# affect the outcome.
- if sys.version_info >= (3, 7, 0, 'beta', 3):
+ if env.PYVERSION >= (3, 7, 0, 'beta', 3):
path0 = os.getcwd()
else:
path0 = ""
@@ -136,7 +137,7 @@ def run_python_file(filename, args, package=None, modulename=None, path0=None):
function will decide on a value.
"""
- if modulename is None and sys.version_info >= (3, 3):
+ if modulename is None and env.PYVERSION >= (3, 3):
modulename = '__main__'
# Create a module to serve as __main__
@@ -263,7 +264,7 @@ def make_code_from_pyc(filename):
raise NoCode("Bad magic number in .pyc file")
date_based = True
- if sys.version_info >= (3, 7, 0, 'alpha', 4):
+ if env.PYVERSION >= (3, 7, 0, 'alpha', 4):
flags = struct.unpack('<L', fpyc.read(4))[0]
hash_based = flags & 0x01
if hash_based:
@@ -272,7 +273,7 @@ def make_code_from_pyc(filename):
if date_based:
# Skip the junk in the header that we don't need.
fpyc.read(4) # Skip the moddate.
- if sys.version_info >= (3, 3):
+ if env.PYVERSION >= (3, 3):
# 3.3 added another long to the header (size), skip it.
fpyc.read(4)
diff --git a/coverage/multiproc.py b/coverage/multiproc.py
index 93b3155..bbc88fb 100644
--- a/coverage/multiproc.py
+++ b/coverage/multiproc.py
@@ -6,8 +6,8 @@
import multiprocessing
import multiprocessing.process
import os
-import sys
+from coverage import env
from coverage.misc import contract
# An attribute that will be set on the module to indicate that it has been
@@ -15,7 +15,7 @@ from coverage.misc import contract
PATCHED_MARKER = "_coverage$patched"
-if sys.version_info >= (3, 4):
+if env.PYVERSION >= (3, 4):
OriginalProcess = multiprocessing.process.BaseProcess
else:
OriginalProcess = multiprocessing.Process
@@ -70,7 +70,7 @@ def patch_multiprocessing(rcfile):
if hasattr(multiprocessing, PATCHED_MARKER):
return
- if sys.version_info >= (3, 4):
+ if env.PYVERSION >= (3, 4):
OriginalProcess._bootstrap = ProcessWithCoverage._bootstrap
else:
multiprocessing.Process = ProcessWithCoverage