Skip to content

Commit

Permalink
test: dropping old Python versions mean we no longer need optimize_if…
Browse files Browse the repository at this point in the history
…_not_debug=0
  • Loading branch information
nedbat committed Feb 6, 2022
1 parent b60b789 commit 5f29141
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
5 changes: 2 additions & 3 deletions coverage/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,19 @@ class PYBEHAVIOR:

# Is "if not __debug__" optimized away? The exact details have changed
# across versions.
optimize_if_not_debug = 0
if pep626:
optimize_if_not_debug = 1
elif PYPY:
if PYVERSION >= (3, 9):
optimize_if_not_debug = 2
elif PYVERSION[:2] == (3, 8):
optimize_if_not_debug = 3
elif PYVERSION[:2] <= (3, 7):
else:
optimize_if_not_debug = 1
else:
if PYVERSION >= (3, 8, 0, 'beta', 1):
optimize_if_not_debug = 2
elif PYVERSION >= (3, 7, 0, 'alpha', 4):
else:
optimize_if_not_debug = 1

# Can co_lnotab have negative deltas?
Expand Down
13 changes: 5 additions & 8 deletions tests/test_arcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1520,16 +1520,14 @@ def test_if_debug(self):
)

def test_if_not_debug(self):
arcz_missing = ""
if env.PYBEHAVIOR.optimize_if_not_debug == 3:
arcz = ".1 12 23 32 37 72 28 8."
if env.PYBEHAVIOR.optimize_if_not_debug == 1:
arcz = ".1 12 23 34 42 37 72 28 8."
elif env.PYBEHAVIOR.optimize_if_not_debug == 2:
arcz = ".1 12 23 35 52 37 72 28 8."
elif env.PYBEHAVIOR.optimize_if_not_debug == 1:
arcz = ".1 12 23 34 42 37 72 28 8."
else:
arcz = ".1 12 23 34 45 42 52 37 72 28 8."
arcz_missing = "45 52"
assert env.PYBEHAVIOR.optimize_if_not_debug == 3
arcz = ".1 12 23 32 37 72 28 8."

self.check_coverage("""\
lines = set()
for value in [True, False]:
Expand All @@ -1541,7 +1539,6 @@ def test_if_not_debug(self):
assert lines == set([7])
""",
arcz=arcz,
arcz_missing=arcz_missing,
)


Expand Down

0 comments on commit 5f29141

Please sign in to comment.