From 284fd45a086f3943b616fed1e608a3109d372c3b Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Fri, 2 Oct 2020 12:13:44 -0700 Subject: [PATCH] py36+: miscellaneous (3, 6) cleanup --- doc/en/skipping.rst | 2 +- src/_pytest/capture.py | 6 +----- src/_pytest/compat.py | 4 +--- testing/acceptance_test.py | 3 --- testing/test_capture.py | 3 +-- testing/test_compat.py | 4 ---- 6 files changed, 4 insertions(+), 18 deletions(-) diff --git a/doc/en/skipping.rst b/doc/en/skipping.rst index 5c67d77a7ec..c463f3293bc 100644 --- a/doc/en/skipping.rst +++ b/doc/en/skipping.rst @@ -91,7 +91,7 @@ when run on an interpreter earlier than Python3.6: import sys - @pytest.mark.skipif(sys.version_info < (3, 6), reason="requires python3.6 or higher") + @pytest.mark.skipif(sys.version_info < (3, 7), reason="requires python3.7 or higher") def test_function(): ... diff --git a/src/_pytest/capture.py b/src/_pytest/capture.py index 2d2b392aba8..629e3c09f86 100644 --- a/src/_pytest/capture.py +++ b/src/_pytest/capture.py @@ -113,11 +113,7 @@ def _py36_windowsconsoleio_workaround(stream: TextIO) -> None: See https://github.com/pytest-dev/py/issues/103. """ - if ( - not sys.platform.startswith("win32") - or sys.version_info[:2] < (3, 6) - or hasattr(sys, "pypy_version_info") - ): + if not sys.platform.startswith("win32") or hasattr(sys, "pypy_version_info"): return # Bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666). diff --git a/src/_pytest/compat.py b/src/_pytest/compat.py index 33221aac2d0..4bb616785ba 100644 --- a/src/_pytest/compat.py +++ b/src/_pytest/compat.py @@ -97,9 +97,7 @@ def syntax, and doesn't contain yield), or a function decorated with def is_async_function(func: object) -> bool: """Return True if the given function seems to be an async function or an async generator.""" - return iscoroutinefunction(func) or ( - sys.version_info >= (3, 6) and inspect.isasyncgenfunction(func) - ) + return iscoroutinefunction(func) or inspect.isasyncgenfunction(func) def getlocation(function, curdir: Optional[str] = None) -> str: diff --git a/testing/acceptance_test.py b/testing/acceptance_test.py index 039d8dad969..01fe97d4f6c 100644 --- a/testing/acceptance_test.py +++ b/testing/acceptance_test.py @@ -1183,9 +1183,6 @@ def test_3(): @pytest.mark.filterwarnings("default") -@pytest.mark.skipif( - sys.version_info < (3, 6), reason="async gen syntax available in Python 3.6+" -) def test_warn_on_async_gen_function(testdir): testdir.makepyfile( test_async=""" diff --git a/testing/test_capture.py b/testing/test_capture.py index 5f820d8465b..317a5922741 100644 --- a/testing/test_capture.py +++ b/testing/test_capture.py @@ -1421,8 +1421,7 @@ def test_capattr(): @pytest.mark.skipif( - not sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6), - reason="only py3.6+ on windows", + not sys.platform.startswith("win"), reason="only on windows", ) def test_py36_windowsconsoleio_workaround_non_standard_streams() -> None: """ diff --git a/testing/test_compat.py b/testing/test_compat.py index 5debe87a3ed..34c8495d29c 100644 --- a/testing/test_compat.py +++ b/testing/test_compat.py @@ -1,5 +1,4 @@ import enum -import sys from functools import partial from functools import wraps from typing import Union @@ -129,9 +128,6 @@ async def bar(): result.stdout.fnmatch_lines(["*1 passed*"]) -@pytest.mark.skipif( - sys.version_info < (3, 6), reason="async gen syntax available in Python 3.6+" -) def test_is_generator_async_gen_syntax(testdir): testdir.makepyfile( """