diff options
-rw-r--r-- | appveyor.yml | 4 | ||||
-rw-r--r-- | coverage/env.py | 4 | ||||
-rw-r--r-- | tests/coveragetest.py | 5 | ||||
-rw-r--r-- | tests/test_arcs.py | 14 |
4 files changed, 25 insertions, 2 deletions
diff --git a/appveyor.yml b/appveyor.yml index 0fb8903d..96fc920e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -90,14 +90,14 @@ environment: - JOB: "3.9 32-bit" TOXENV: "py39" PYTHON: "C:\\Python39" - PYTHON_VERSION: "3.9.0a1" + PYTHON_VERSION: "3.9.0a2" PYTHON_ARCH: "32" COVERAGE_NO_PYTRACER: "1" - JOB: "3.9 64-bit" TOXENV: "py39" PYTHON: "C:\\Python39-x64" - PYTHON_VERSION: "3.9.0a1" + PYTHON_VERSION: "3.9.0a2" PYTHON_ARCH: "64" # Meta coverage diff --git a/coverage/env.py b/coverage/env.py index 0d4642ef..1c09caf1 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -81,6 +81,10 @@ class PYBEHAVIOR(object): # Python 3.9a1 made sys.argv[0] and other reported files absolute paths. report_absolute_files = (PYVERSION >= (3, 9)) + # Python 3.9a2 changed how return/finally was traced, but it could be + # temporary. + bug39114 = (PYVERSION >= (3, 9, 0, 'alpha', 2)) + # Coverage.py specifics. # Are we using the C-implemented trace function? diff --git a/tests/coveragetest.py b/tests/coveragetest.py index 1a2983e6..17b3f15d 100644 --- a/tests/coveragetest.py +++ b/tests/coveragetest.py @@ -15,6 +15,7 @@ import shlex import sys import types +import pytest from unittest_mixins import ( EnvironmentAwareMixin, StdStreamCapturingMixin, TempDirMixin, DelayedAssertionMixin, @@ -99,6 +100,10 @@ class CoverageTest( self.last_command_output = None self.last_module_name = None + def xfail(self, msg): + """Mark this test as an expected failure.""" + pytest.xfail(msg) + def clean_local_file_imports(self): """Clean up the results of calls to `import_local_file`. diff --git a/tests/test_arcs.py b/tests/test_arcs.py index bf17f712..5ba2908f 100644 --- a/tests/test_arcs.py +++ b/tests/test_arcs.py @@ -630,6 +630,8 @@ class ExceptionArcTest(CoverageTest): def test_break_through_finally(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") if env.PYBEHAVIOR.finally_jumps_back: arcz = ".1 12 23 34 3D 45 56 67 68 7A 7D 8A A3 A7 BC CD D." else: @@ -654,6 +656,8 @@ class ExceptionArcTest(CoverageTest): ) def test_continue_through_finally(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") if env.PYBEHAVIOR.finally_jumps_back: arcz = ".1 12 23 34 3D 45 56 67 68 73 7A 8A A3 A7 BC CD D." else: @@ -691,6 +695,8 @@ class ExceptionArcTest(CoverageTest): ) def test_bug_212(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") # "except Exception as e" is crucial here. # Bug 212 said that the "if exc" line was incorrectly marked as only # partially covered. @@ -813,6 +819,8 @@ class ExceptionArcTest(CoverageTest): ) def test_return_finally(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") if env.PYBEHAVIOR.finally_jumps_back: arcz = ".1 12 29 9A AB BC C-1 -23 34 45 5-2 57 75 38 8-2" else: @@ -835,6 +843,8 @@ class ExceptionArcTest(CoverageTest): ) def test_except_jump_finally(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") if env.PYBEHAVIOR.finally_jumps_back: arcz = ( ".1 1Q QR RS ST TU U. " @@ -889,6 +899,8 @@ class ExceptionArcTest(CoverageTest): ) def test_else_jump_finally(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") if env.PYBEHAVIOR.finally_jumps_back: arcz = ( ".1 1S ST TU UV VW W. " @@ -1511,6 +1523,8 @@ class AsyncTest(CoverageTest): self.assertEqual(self.stdout(), "Compute 1 + 2 ...\n1 + 2 = 3\n") def test_async_for(self): + if env.PYBEHAVIOR.bug39114: + self.xfail("https://bugs.python.org/issue39114") self.check_coverage("""\ import asyncio |