summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-01-10 08:33:07 -0500
committerNed Batchelder <ned@nedbatchelder.com>2021-01-10 09:46:18 -0500
commit0ac78b400e6d45debc626748c1c94b9e1868c645 (patch)
treeeab4f2b02da588d14f6a6e9e170ccfe8b552417b
parentc7649842853de89c9a67c3f361f967349b17cb5f (diff)
downloadpython-coveragepy-git-0ac78b400e6d45debc626748c1c94b9e1868c645.tar.gz
Clean up the platform constants in env.py
-rw-r--r--coverage/env.py13
-rw-r--r--tests/test_process.py2
2 files changed, 8 insertions, 7 deletions
diff --git a/coverage/env.py b/coverage/env.py
index f2881e32..b91af463 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -11,24 +11,25 @@ import sys
WINDOWS = sys.platform == "win32"
LINUX = sys.platform.startswith("linux")
+# Python implementations.
+CPYTHON = (platform.python_implementation() == "CPython")
+PYPY = (platform.python_implementation() == "PyPy")
+JYTHON = (platform.python_implementation() == "Jython")
+IRONPYTHON = (platform.python_implementation() == "IronPython")
+
# Python versions. We amend version_info with one more value, a zero if an
# official version, or 1 if built from source beyond an official version.
PYVERSION = sys.version_info + (int(platform.python_version()[-1] == "+"),)
PY2 = PYVERSION < (3, 0)
PY3 = PYVERSION >= (3, 0)
-# Python implementations.
-PYPY = (platform.python_implementation() == 'PyPy')
if PYPY:
PYPYVERSION = sys.pypy_version_info
PYPY2 = PYPY and PY2
PYPY3 = PYPY and PY3
-JYTHON = (platform.python_implementation() == 'Jython')
-IRONPYTHON = (platform.python_implementation() == 'IronPython')
-
-# Python behavior
+# Python behavior.
class PYBEHAVIOR(object):
"""Flags indicating this Python's behavior."""
diff --git a/tests/test_process.py b/tests/test_process.py
index 9fb930de..e4886156 100644
--- a/tests/test_process.py
+++ b/tests/test_process.py
@@ -1099,7 +1099,7 @@ class ExcepthookTest(CoverageTest):
self.assertEqual(line_counts(data)['excepthook.py'], 7)
def test_excepthook_exit(self):
- if env.PYPY or env.JYTHON:
+ if not env.CPYTHON:
self.skipTest("non-CPython handles excepthook exits differently, punt for now.")
self.make_file("excepthook_exit.py", """\
import sys