From 5f2914159e8cf4c5130dcd269c61e12ba0050190 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 6 Feb 2022 18:36:24 -0500 Subject: [PATCH] test: dropping old Python versions mean we no longer need optimize_if_not_debug=0 --- coverage/env.py | 5 ++--- tests/test_arcs.py | 13 +++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/coverage/env.py b/coverage/env.py index 1922d93fc..ecc40c4f6 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -41,7 +41,6 @@ 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: @@ -49,12 +48,12 @@ class PYBEHAVIOR: 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? diff --git a/tests/test_arcs.py b/tests/test_arcs.py index 731e84275..7991a4ad4 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -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]: @@ -1541,7 +1539,6 @@ def test_if_not_debug(self): assert lines == set([7]) """, arcz=arcz, - arcz_missing=arcz_missing, )