From a0ab1d52edd604dc6a7dfdb568a25dad63ea7068b6b5d81694d57e8b74f562f0 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Thu, 3 Jun 2021 12:46:56 +0000 Subject: [PATCH 1/2] Accepting request 897120 from home:alarrosa:branches:devel:languages:python:pytest - Update to 0.15.1 * Hotfix for errors while closing event loops while replacing them. #209 #210 - Update to 0.15.0 * 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. * Set unused_tcp_port_factory fixture scope to 'session'. #163 * Properly close event loops when replacing them. #208 OBS-URL: https://build.opensuse.org/request/show/897120 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-asyncio?expand=0&rev=14 --- pytest-asyncio-0.14.0.tar.gz | 3 --- pytest-asyncio-0.15.1.tar.gz | 3 +++ python-pytest-asyncio.changes | 13 +++++++++++++ python-pytest-asyncio.spec | 4 ++-- 4 files changed, 18 insertions(+), 5 deletions(-) delete mode 100644 pytest-asyncio-0.14.0.tar.gz create mode 100644 pytest-asyncio-0.15.1.tar.gz diff --git a/pytest-asyncio-0.14.0.tar.gz b/pytest-asyncio-0.14.0.tar.gz deleted file mode 100644 index f7051a6..0000000 --- a/pytest-asyncio-0.14.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:95c1ace9c204deaca484dcb4bf3beed4afda38cf7f1721f4ce74567bb23a30f1 -size 14796 diff --git a/pytest-asyncio-0.15.1.tar.gz b/pytest-asyncio-0.15.1.tar.gz new file mode 100644 index 0000000..643e532 --- /dev/null +++ b/pytest-asyncio-0.15.1.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a8c0f2bd36c3a0c03b9fbf707be03e8316019e32333a704d09309e8459ed7ffe +size 15653 diff --git a/python-pytest-asyncio.changes b/python-pytest-asyncio.changes index 63b8a36..8fcac37 100644 --- a/python-pytest-asyncio.changes +++ b/python-pytest-asyncio.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Thu Jun 3 09:53:19 UTC 2021 - Antonio Larrosa + +- Update to 0.15.1 + * Hotfix for errors while closing event loops while replacing + them. #209 #210 +- Update to 0.15.0 + * 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. + * Set unused_tcp_port_factory fixture scope to 'session'. #163 + * Properly close event loops when replacing them. #208 + ------------------------------------------------------------------- Mon Jun 29 09:10:04 UTC 2020 - Marketa Calabkova diff --git a/python-pytest-asyncio.spec b/python-pytest-asyncio.spec index 415a431..1852a60 100644 --- a/python-pytest-asyncio.spec +++ b/python-pytest-asyncio.spec @@ -1,7 +1,7 @@ # # spec file for package python-pytest-asyncio # -# Copyright (c) 2020 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,7 +19,7 @@ %define skip_python2 1 %{?!python_module:%define python_module() python3-%{**}} Name: python-pytest-asyncio -Version: 0.14.0 +Version: 0.15.1 Release: 0 Summary: Pytest support for asyncio License: Apache-2.0 From 0a1d6d058da3df50c18af0319fc07627e21f0c909b8e14e084fdee84024aa7d5 Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Mon, 5 Jul 2021 08:53:13 +0000 Subject: [PATCH 2/2] Accepting request 904059 from home:alarrosa:branches:devel:languages:python:pytest This should fix Staging:F . Or said in another way, it should fix python-fakeredis failing with: [ 59s] _______________________________ test_ping[fake] ________________________________ [ 59s] [ 59s] r = [ 59s] [ 59s] async def test_ping(r): [ 59s] > pong = await r.ping() [ 59s] E AttributeError: 'AsyncGenerator' object has no attribute 'ping' [ 59s] [ 59s] test/test_aioredis.py:45: AttributeError ... - 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 OBS-URL: https://build.opensuse.org/request/show/904059 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-asyncio?expand=0&rev=15 --- 0001-removed-support-for-python-3.5.patch | 188 ++++++++++++++++++++++ python-pytest-asyncio.changes | 8 + python-pytest-asyncio.spec | 2 + 3 files changed, 198 insertions(+) create mode 100644 0001-removed-support-for-python-3.5.patch 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