Merge pull request #7835 from asottile/py36_misc

py36+: miscellaneous (3, 6) cleanup
This commit is contained in:
Anthony Sottile 2020-10-02 19:47:35 -07:00 committed by GitHub
commit ac189885f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 4 additions and 18 deletions

View File

@ -91,7 +91,7 @@ when run on an interpreter earlier than Python3.6:
import sys 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(): def test_function():
... ...

View File

@ -113,11 +113,7 @@ def _py36_windowsconsoleio_workaround(stream: TextIO) -> None:
See https://github.com/pytest-dev/py/issues/103. See https://github.com/pytest-dev/py/issues/103.
""" """
if ( if not sys.platform.startswith("win32") or hasattr(sys, "pypy_version_info"):
not sys.platform.startswith("win32")
or sys.version_info[:2] < (3, 6)
or hasattr(sys, "pypy_version_info")
):
return return
# Bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666). # Bail out if ``stream`` doesn't seem like a proper ``io`` stream (#2666).

View File

@ -87,9 +87,7 @@ def iscoroutinefunction(func: object) -> bool:
def is_async_function(func: object) -> bool: def is_async_function(func: object) -> bool:
"""Return True if the given function seems to be an async function or """Return True if the given function seems to be an async function or
an async generator.""" an async generator."""
return iscoroutinefunction(func) or ( return iscoroutinefunction(func) or inspect.isasyncgenfunction(func)
sys.version_info >= (3, 6) and inspect.isasyncgenfunction(func)
)
def getlocation(function, curdir: Optional[str] = None) -> str: def getlocation(function, curdir: Optional[str] = None) -> str:

View File

@ -1180,9 +1180,6 @@ def test_warn_on_async_function(testdir):
@pytest.mark.filterwarnings("default") @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): def test_warn_on_async_gen_function(testdir):
testdir.makepyfile( testdir.makepyfile(
test_async=""" test_async="""

View File

@ -1421,8 +1421,7 @@ def test_error_attribute_issue555(testdir):
@pytest.mark.skipif( @pytest.mark.skipif(
not sys.platform.startswith("win") and sys.version_info[:2] >= (3, 6), not sys.platform.startswith("win"), reason="only on windows",
reason="only py3.6+ on windows",
) )
def test_py36_windowsconsoleio_workaround_non_standard_streams() -> None: def test_py36_windowsconsoleio_workaround_non_standard_streams() -> None:
""" """

View File

@ -1,5 +1,4 @@
import enum import enum
import sys
from functools import partial from functools import partial
from functools import wraps from functools import wraps
from typing import TYPE_CHECKING from typing import TYPE_CHECKING
@ -129,9 +128,6 @@ def test_is_generator_async_syntax(testdir):
result.stdout.fnmatch_lines(["*1 passed*"]) 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): def test_is_generator_async_gen_syntax(testdir):
testdir.makepyfile( testdir.makepyfile(
""" """