Skip to content

Commit

Permalink
Merge pull request #7835 from asottile/py36_misc
Browse files Browse the repository at this point in the history
py36+: miscellaneous (3, 6) cleanup
  • Loading branch information
asottile committed Oct 3, 2020
2 parents 6ba13ed + 284fd45 commit ac18988
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doc/en/skipping.rst
Expand Up @@ -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():
...
Expand Down
6 changes: 1 addition & 5 deletions src/_pytest/capture.py
Expand Up @@ -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).
Expand Down
4 changes: 1 addition & 3 deletions src/_pytest/compat.py
Expand Up @@ -87,9 +87,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:
Expand Down
3 changes: 0 additions & 3 deletions testing/acceptance_test.py
Expand Up @@ -1180,9 +1180,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="""
Expand Down
3 changes: 1 addition & 2 deletions testing/test_capture.py
Expand Up @@ -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:
"""
Expand Down
4 changes: 0 additions & 4 deletions testing/test_compat.py
@@ -1,5 +1,4 @@
import enum
import sys
from functools import partial
from functools import wraps
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -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(
"""
Expand Down

0 comments on commit ac18988

Please sign in to comment.