summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2021-05-01 14:19:24 -0400
committerNed Batchelder <ned@nedbatchelder.com>2021-05-01 16:24:37 -0400
commit3d43c74cd2dd8c66c29572bc04a4b0de3e206364 (patch)
tree282d10151f6ba009fdd8d8a1d8713a0fc5441026
parent7db98362f368ac569edf66228d52cbc64a6d69aa (diff)
downloadpython-coveragepy-git-3d43c74cd2dd8c66c29572bc04a4b0de3e206364.tar.gz
refactor: remove some unneeded behavior conditionals
-rw-r--r--coverage/env.py15
-rw-r--r--coverage/execfile.py5
-rw-r--r--tests/test_api.py3
-rw-r--r--tests/test_arcs.py7
4 files changed, 2 insertions, 28 deletions
diff --git a/coverage/env.py b/coverage/env.py
index f0d98a27..ab59e275 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -53,21 +53,6 @@ class PYBEHAVIOR(object):
if pep626:
optimize_if_not_debug2 = False
- # Do we have yield-from?
- yield_from = (PYVERSION >= (3, 3))
-
- # Do we have PEP 420 namespace packages?
- namespaces_pep420 = (PYVERSION >= (3, 3))
-
- # Do .pyc files have the source file size recorded in them?
- size_in_pyc = (PYVERSION >= (3, 3))
-
- # Do we have async and await syntax?
- async_syntax = (PYVERSION >= (3, 5))
-
- # PEP 448 defined additional unpacking generalizations
- unpackings_pep448 = (PYVERSION >= (3, 5))
-
# Can co_lnotab have negative deltas?
negative_lnotab = (PYVERSION >= (3, 6)) and not (PYPY and PYPYVERSION < (7, 2))
diff --git a/coverage/execfile.py b/coverage/execfile.py
index 600b2278..338fb477 100644
--- a/coverage/execfile.py
+++ b/coverage/execfile.py
@@ -346,9 +346,8 @@ 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 env.PYBEHAVIOR.size_in_pyc:
- # 3.3 added another long to the header (size), skip it.
- fpyc.read(4)
+ # 3.3 added another long to the header (size), skip it.
+ fpyc.read(4)
# The rest of the file is the code object we want.
code = marshal.load(fpyc)
diff --git a/tests/test_api.py b/tests/test_api.py
index 42ef986d..b17f9ee0 100644
--- a/tests/test_api.py
+++ b/tests/test_api.py
@@ -763,9 +763,6 @@ class CurrentInstanceTest(CoverageTest):
assert cur0 is cur3
-@pytest.mark.skipif(not env.PYBEHAVIOR.namespaces_pep420,
- reason="Python before 3.3 doesn't have namespace packages"
-)
class NamespaceModuleTest(UsingModulesMixin, CoverageTest):
"""Test PEP-420 namespace modules."""
diff --git a/tests/test_arcs.py b/tests/test_arcs.py
index 3f634a85..8bf83008 100644
--- a/tests/test_arcs.py
+++ b/tests/test_arcs.py
@@ -1072,9 +1072,6 @@ class YieldTest(CoverageTest):
)
assert self.stdout() == "20\n12\n"
- @pytest.mark.skipif(not env.PYBEHAVIOR.yield_from,
- reason="Python before 3.3 doesn't have 'yield from'"
- )
def test_yield_from(self):
self.check_coverage("""\
def gen(inp):
@@ -1320,9 +1317,6 @@ class MiscArcTest(CoverageTest):
arcz=".1 19 9.",
)
- @pytest.mark.skipif(not env.PYBEHAVIOR.unpackings_pep448,
- reason="Don't have unpacked literals until 3.5"
- )
def test_unpacked_literals(self):
self.check_coverage("""\
d = {
@@ -1570,7 +1564,6 @@ class LambdaArcTest(CoverageTest):
)
-@pytest.mark.skipif(not env.PYBEHAVIOR.async_syntax, reason="Async features are new in Python 3.5")
class AsyncTest(CoverageTest):
"""Tests of the new async and await keywords in Python 3.5"""