diff --git a/0001-removed-support-for-python-3.5.patch b/0001-removed-support-for-python-3.5.patch new file mode 100644 index 0000000..77938a1 --- /dev/null +++ b/0001-removed-support-for-python-3.5.patch @@ -0,0 +1,188 @@ +From 057562f8aaf9f18d97326a86dbdb9587e866bfe0 Mon Sep 17 00:00:00 2001 +From: Michael Seifert +Date: Tue, 6 Oct 2020 11:00:21 +0200 +Subject: [PATCH] feat!: Removed support for Python 3.5. + +This commit: +- Removes Python 3.5 from the tested environments in CI and tox +- Removes instructions specific to Python 3.5 from the README +- Updates the Changelog +- Removes the dependency on async_generator +- Removes instructions in conftest that skip certain test cases if the Python version is smaller than 3.6 + +Signed-off-by: Michael Seifert +--- + .travis.yml | 2 - + README.rst | 14 +------ + pytest_asyncio/plugin.py | 5 +-- + setup.py | 5 +-- + .../test_async_gen_fixtures_35.py | 40 ------------------- + tests/conftest.py | 6 --- + tox.ini | 2 +- + 7 files changed, 4 insertions(+), 70 deletions(-) + delete mode 100644 tests/async_fixtures/test_async_gen_fixtures_35.py + +#diff --git a/.travis.yml b/.travis.yml +#index db43fef..a19d5d7 100644 +#--- a/.travis.yml +#+++ b/.travis.yml +#@@ -2,8 +2,6 @@ language: python +# +# matrix: +# include: +#- - python: 3.5 +#- env: TOX_ENV=py35 +# - python: 3.6 +# env: TOX_ENV=py36 +# - python: 3.7 +#diff --git a/README.rst b/README.rst +#index 64698c6..2f282b5 100644 +#--- a/README.rst +#+++ b/README.rst +#@@ -127,19 +127,6 @@ to redefine the ``event_loop`` fixture to have the same or broader scope. +# Async fixtures need the event loop, and so must have the same or narrower scope +# than the ``event_loop`` fixture. +# +#-If you want to do this with Python 3.5, the ``yield`` statement must be replaced with ``await yield_()`` and the coroutine +#-function must be decorated with ``@async_generator``, like so: +#- +#-.. code-block:: python3 +#- +#- from async_generator import yield_, async_generator +#- +#- @pytest.fixture +#- @async_generator +#- async def async_gen_fixture(): +#- await asyncio.sleep(0.1) +#- await yield_('a value') +#- +# +# Markers +# ------- +#@@ -178,6 +165,7 @@ Changelog +# 0.15.0 (UNRELEASED) +# ~~~~~~~~~~~~~~~~~~~ +# - Add support for Python 3.9 +#+- Abandon support for Python 3.5. If you still require support for Python 3.5, please use pytest-asyncio v0.14 or earlier. +# +# 0.14.0 (2020-06-24) +# ~~~~~~~~~~~~~~~~~~~ +diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py +index 2fdc5f4..4b7d6fd 100644 +--- a/pytest_asyncio/plugin.py ++++ b/pytest_asyncio/plugin.py +@@ -13,10 +13,7 @@ def transfer_markers(*args, **kwargs): # noqa + pass + + +-try: +- from async_generator import isasyncgenfunction +-except ImportError: +- from inspect import isasyncgenfunction ++from inspect import isasyncgenfunction + + + def _is_coroutine(obj): +diff --git a/setup.py b/setup.py +index ff3855c..2df6fae 100644 +--- a/setup.py ++++ b/setup.py +@@ -33,7 +33,6 @@ def find_version(): + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", +- "Programming Language :: Python :: 3.5", + "Programming Language :: Python :: 3.6", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", +@@ -41,13 +40,11 @@ def find_version(): + "Topic :: Software Development :: Testing", + "Framework :: Pytest", + ], +- python_requires=">= 3.5", ++ python_requires=">= 3.6", + install_requires=["pytest >= 5.4.0"], + extras_require={ +- ':python_version == "3.5"': "async_generator >= 1.3", + "testing": [ + "coverage", +- "async_generator >= 1.3", + "hypothesis >= 5.7.1", + ], + }, +#diff --git a/tests/async_fixtures/test_async_gen_fixtures_35.py b/tests/async_fixtures/test_async_gen_fixtures_35.py +#deleted file mode 100644 +#index 3b552fa..0000000 +#--- a/tests/async_fixtures/test_async_gen_fixtures_35.py +#+++ /dev/null +#@@ -1,40 +0,0 @@ +#-import unittest.mock +#- +#-import pytest +#-from async_generator import yield_, async_generator +#- +#-START = object() +#-END = object() +#-RETVAL = object() +#- +#- +#-@pytest.fixture(scope='module') +#-def mock(): +#- return unittest.mock.Mock(return_value=RETVAL) +#- +#- +#-@pytest.fixture +#-@async_generator +#-async def async_gen_fixture(mock): +#- try: +#- await yield_(mock(START)) +#- except Exception as e: +#- mock(e) +#- else: +#- mock(END) +#- +#- +#-@pytest.mark.asyncio +#-async def test_async_gen_fixture(async_gen_fixture, mock): +#- assert mock.called +#- assert mock.call_args_list[-1] == unittest.mock.call(START) +#- assert async_gen_fixture is RETVAL +#- +#- +#-@pytest.mark.asyncio +#-async def test_async_gen_fixture_finalized(mock): +#- try: +#- assert mock.called +#- assert mock.call_args_list[-1] == unittest.mock.call(END) +#- finally: +#- mock.reset_mock() +#diff --git a/tests/conftest.py b/tests/conftest.py +#index cc2ec16..1ca63fe 100644 +#--- a/tests/conftest.py +#+++ b/tests/conftest.py +#@@ -1,13 +1,7 @@ +# import asyncio +#-import sys +# +# import pytest +# +#-collect_ignore = [] +#-if sys.version_info[:2] < (3, 6): +#- collect_ignore.append("async_fixtures/test_async_gen_fixtures_36.py") +#- collect_ignore.append("async_fixtures/test_nested_36.py") +#- +# +# @pytest.fixture +# def dependent_fixture(event_loop): +#diff --git a/tox.ini b/tox.ini +#index 6cc4a82..f739cc5 100644 +#--- a/tox.ini +#+++ b/tox.ini +#@@ -1,6 +1,6 @@ +# [tox] +# minversion = 3.14.0 +#-envlist = py35, py36, py37, py38, py39 +#+envlist = py36, py37, py38, py39 +# skip_missing_interpreters = true +# +# [testenv] diff --git a/python-pytest-asyncio.changes b/python-pytest-asyncio.changes index 8fcac37..0215fe9 100644 --- a/python-pytest-asyncio.changes +++ b/python-pytest-asyncio.changes @@ -1,3 +1,11 @@ +------------------------------------------------------------------- +Mon Jul 5 08:38:37 UTC 2021 - Antonio Larrosa + +- Add patch to revert a change in 0.15.1 that removed + async_generator support in upstream together with python 3.5 + support. This revert is needed by python-fakeredis 1.5.2 + * 0001-removed-support-for-python-3.5.patch + ------------------------------------------------------------------- Thu Jun 3 09:53:19 UTC 2021 - Antonio Larrosa diff --git a/python-pytest-asyncio.spec b/python-pytest-asyncio.spec index 1852a60..87d78ac 100644 --- a/python-pytest-asyncio.spec +++ b/python-pytest-asyncio.spec @@ -25,6 +25,7 @@ Summary: Pytest support for asyncio License: Apache-2.0 URL: https://github.com/pytest-dev/pytest-asyncio Source: https://github.com/pytest-dev/pytest-asyncio/archive/v%{version}.tar.gz#/pytest-asyncio-%{version}.tar.gz +Patch0: 0001-removed-support-for-python-3.5.patch BuildRequires: %{python_module async_generator >= 1.3} BuildRequires: %{python_module base >= 3.6} BuildRequires: %{python_module hypothesis >= 5.7.1} @@ -46,6 +47,7 @@ provides useful fixtures and markers to make testing easier. %prep %setup -q -n pytest-asyncio-%{version} sed -ie '1i# -*- coding: utf-8 -*-' setup.py +%patch0 -p1 -R %build %python_build