Sync from SUSE:SLFO:Main python-pytest-asyncio revision 7f7e2346e70643a9d9e3840baabd4ba9

This commit is contained in:
Adrian Schröter 2024-05-03 22:18:17 +02:00
commit 9f1d44614e
6 changed files with 364 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

3
_multibuild Normal file
View File

@ -0,0 +1,3 @@
<multibuild>
<package>test</package>
</multibuild>

View File

@ -0,0 +1,46 @@
From fd57e55db1170c029324a7a9c56f86f14468217e Mon Sep 17 00:00:00 2001
From: Michael Seifert <m.seifert@digitalernachschub.de>
Date: Mon, 18 Sep 2023 09:50:47 +0200
Subject: [PATCH] [test] Addresses a Hypothesis health check that leads to
failing tests.
Class-based tests that inherit a Hypothesis test case emit a Hypothesis health check warning starting from hypothesis-6.83.2 [0][1]. This is due to inherited tests being run by different Hypothesis executors and may cause issues when replaying examples [2].
Inheriting Hypothesis tests in subclasses is clearly not wanted, so it makes sense to remove the pytest-asyncio test that tests for this feature.
[0] https://hypothesis.readthedocs.io/en/latest/changes.html#v6-83-2
[1] https://github.com/HypothesisWorks/hypothesis/pull/3720
[2] https://github.com/HypothesisWorks/hypothesis/issues/3446
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
---
tests/hypothesis/test_inherited_test.py | 20 --------------------
1 file changed, 20 deletions(-)
delete mode 100644 tests/hypothesis/test_inherited_test.py
diff --git a/tests/hypothesis/test_inherited_test.py b/tests/hypothesis/test_inherited_test.py
deleted file mode 100644
index a7762264..00000000
--- a/tests/hypothesis/test_inherited_test.py
+++ /dev/null
@@ -1,20 +0,0 @@
-import hypothesis.strategies as st
-import pytest
-from hypothesis import given
-
-
-class BaseClass:
- @pytest.mark.asyncio
- @given(value=st.integers())
- async def test_hypothesis(self, value: int) -> None:
- pass
-
-
-class TestOne(BaseClass):
- """During the first execution the Hypothesis test
- is wrapped in a synchronous function."""
-
-
-class TestTwo(BaseClass):
- """Execute the test a second time to ensure that
- the test receives a fresh event loop."""

BIN
pytest-asyncio-0.21.1.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,196 @@
-------------------------------------------------------------------
Tue Oct 17 08:19:39 UTC 2023 - Markéta Machová <mmachova@suse.com>
- Add hypothesis-health-check.patch to fix tests
-------------------------------------------------------------------
Mon Jul 24 18:40:25 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.21.1:
* Output a proper error message when an invalid
``asyncio_mode`` is selected.
* Extend warning message about unclosed event loops with
additional possible cause.
* Previously, some tests reported "skipped" or "xfailed" as a
result. Now all tests report a "success" result.
-------------------------------------------------------------------
Thu May 4 22:36:44 UTC 2023 - Dirk Müller <dmueller@suse.com>
- update to 0.21.0:
* Drop compatibility with pytest 6.1. Pytest-asyncio now
depends on pytest 7.0 or newer.
* pytest-asyncio cleans up any stale event loops when setting
up and tearing down the event_loop fixture.
-------------------------------------------------------------------
Fri Apr 21 12:31:26 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Thu Apr 13 22:43:58 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Make calling of %{sle15modernpython} optional.
-------------------------------------------------------------------
Fri Dec 9 11:11:04 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Update to 0.20.3:
* Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. #460
-------------------------------------------------------------------
Wed Nov 30 07:13:34 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
- Update to 0.20.2:
* Fixes an issue with async fixtures that are defined as methods on a test
class not being rebound to the actual test instance. #197
* Replaced usage of deprecated @pytest.mark.tryfirst with
@pytest.hookimpl(tryfirst=True) #438
- 0.20.1 (22-10-21)
* Fixes an issue that warned about using an old version of pytest, even
though the most recent version was installed. #430
- 0.20.0 (22-10-21)
* BREAKING: Removed legacy mode. If you're upgrading from v0.19 and you
haven't configured asyncio_mode = legacy, you can upgrade without taking
any additional action. If you're upgrading from an earlier version or you
have explicitly enabled legacy mode, you need to switch to auto or strict
mode before upgrading to this version.
* Deprecate use of pytest v6.
* Fixed an issue which prevented fixture setup from being cached. #404
-------------------------------------------------------------------
Fri Aug 5 04:57:24 UTC 2022 - John Vandenberg <jayvdb@gmail.com>
- Update to 0.19.0
* BREAKING: The default ``asyncio_mode`` is now *strict*.
* Removes `setup.py` since all relevant configuration is present
`setup.cfg`.
* Declare support for Python 3.11
-------------------------------------------------------------------
Wed Jul 6 07:59:54 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
- Inject multibuild to defeat a build loop
-------------------------------------------------------------------
Tue Jun 28 19:00:14 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 0.18.3
* Adds pytest-trio to the test dependencies
* Fixes a bug that caused pytest-asyncio to try to set up async
pytest_trio fixtures in strict mode. #298
- Release 0.18.2
* Fix asyncio auto mode not marking static methods. #295
* Fix a compatibility issue with Hypothesis 6.39.0. #302
- Release 0.18.1
* Fixes a regression that prevented async fixtures from working
in synchronous tests. #286
- Release 0.18.0
* Raise a warning if @pytest.mark.asyncio is applied to non-async
function. #275
* Support parametrized event_loop fixture. #278
-------------------------------------------------------------------
Thu Jan 20 16:39:35 UTC 2022 - Ben Greiner <code@bnavigator.de>
- Update to 0.17.2
* Require typing-extensions on Python<3.8 only. #269
* Fix a regression in tests collection introduced by 0.17.1, the
plugin works fine with non-python tests again. #267
- Release notes for 0.17.1
* Fixes a bug that prevents async Hypothesis tests from working
without explicit asyncio marker when --asyncio-mode=auto is
set. #258
* Fixed a bug that closes the default event loop if the loop
doesn't exist #257
* Added type annotations. #198
* Show asyncio mode in pytest report headers. #266
* Relax asyncio_mode type definition; it allows to support pytest
6.1+. #262
- Release notes for 0.17.0
* pytest-asyncio no longer alters existing event loop policies.
#168, #188
* Drop support for Python 3.6
* Fixed an issue when pytest-asyncio was used in combination with
flaky or inherited asynchronous Hypothesis tests. #178 #231
* Added flaky to test dependencies
* Added unused_udp_port and unused_udp_port_factory fixtures
(similar to unused_tcp_port and unused_tcp_port_factory
counterparts. #99
* Added the plugin modes: strict, auto, and legacy. See
documentation for details. #125
* Correctly process KeyboardInterrupt during async fixture setup
phase #219
-------------------------------------------------------------------
Sun Oct 17 13:20:44 UTC 2021 - Ben Greiner <code@bnavigator.de>
- Update to 0.16.0
* Add support for Python 3.10
- Drop 0001-removed-support-for-python-3.5.patch not required by
fakeredis 1.6.0 anymore
-------------------------------------------------------------------
Mon Jul 5 08:38:37 UTC 2021 - Antonio Larrosa <alarrosa@suse.com>
- 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 <alarrosa@suse.com>
- 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 <mcalabkova@suse.com>
- Update to 0.14.0
* Fix #162, and event_loop fixture behavior now is coherent on all scopes.
-------------------------------------------------------------------
Tue Jun 9 08:13:59 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.12.0:
* Run the event loop fixture as soon as possible.
-------------------------------------------------------------------
Mon Apr 27 10:36:39 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.11.0:
* Fix with pytest 5.4
-------------------------------------------------------------------
Mon Mar 9 09:37:18 UTC 2020 - Tomáš Chvátal <tchvatal@suse.com>
- Fix test run on python 3.8+
-------------------------------------------------------------------
Wed Feb 13 13:14:40 UTC 2019 - Tomáš Chvátal <tchvatal@suse.com>
- Update to 0.10.0:
* support for pytest 4+
-------------------------------------------------------------------
Tue Sep 4 13:10:57 UTC 2018 - Ondřej Súkup <mimi.vx@gmail.com>
- update to 0.9.0
- use github tarbal due packaging errrors in upstream
* Python 3.7 support.
* Remove event_loop_process_pool fixture
and pytest.mark.asyncio_process_pool marker
-------------------------------------------------------------------
Fri Jan 5 09:47:11 UTC 2018 - alarrosa@suse.com
- Initial release of python-pytest-asyncio 0.8.0

View File

@ -0,0 +1,93 @@
#
# spec file
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%global flavor @BUILD_FLAVOR@%{nil}
%if "%{flavor}" == "test"
%define psuffix -test
%bcond_without test
%else
%define psuffix %{nil}
%bcond_with test
%endif
%{?sle15_python_module_pythons}
Name: python-pytest-asyncio%{psuffix}
Version: 0.21.1
Release: 0
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
# PATCH-FIX-UPSTREAM https://github.com/pytest-dev/pytest-asyncio/commit/fd57e55db1170c029324a7a9c56f86f14468217e [test] Addresses a Hypothesis health check that leads to failing tests.
Patch: hypothesis-health-check.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pytest >= 7.0.0
%if 0%{?python_version_nodots} < 38
Requires: python-typing-extensions >= 3.7.2
%endif
BuildArch: noarch
%if %{with test}
BuildRequires: %{python_module async_generator >= 1.3}
BuildRequires: %{python_module flaky >= 3.5.0}
BuildRequires: %{python_module hypothesis >= 5.7.1}
BuildRequires: %{python_module pytest >= 7.0.0}
BuildRequires: %{python_module pytest-asyncio = %{version}}
BuildRequires: %{python_module pytest-trio >= 0.7}
%endif
%python_subpackages
%description
pytest-asyncio is a Python library used for testing asyncio code with pytest.
asyncio code is usually written in the form of coroutines, which makes it
slightly more difficult to test using normal testing tools. pytest-asyncio
provides useful fixtures and markers to make testing easier.
%prep
%autosetup -p1 -n pytest-asyncio-%{version}
%build
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_wheel
%if !%{with test}
%install
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%endif
%if %{with test}
%check
%pytest
%endif
%if !%{with test}
%files %{python_files}
%doc README.rst
%license LICENSE
%{python_sitelib}/pytest_asyncio
%{python_sitelib}/pytest_asyncio-%{version}*-info
%endif
%changelog