Sync from SUSE:SLFO:Main python-pytest-asyncio revision ec626b9bae06ef1af44f8533d38e800c
This commit is contained in:
parent
9f1d44614e
commit
dedd673f30
86
duplicated-markers.patch
Normal file
86
duplicated-markers.patch
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
From b646cc18a222c8043433c38a42c07245fe9735ce Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Seifert <m.seifert@digitalernachschub.de>
|
||||||
|
Date: Sun, 19 May 2024 14:00:57 +0200
|
||||||
|
Subject: [PATCH] [fix] Fixed a bug that causes markers to be duplicated for
|
||||||
|
async test functions.
|
||||||
|
|
||||||
|
Signed-off-by: Michael Seifert <m.seifert@digitalernachschub.de>
|
||||||
|
---
|
||||||
|
docs/source/reference/changelog.rst | 9 ++++++++
|
||||||
|
pytest_asyncio/plugin.py | 3 ++-
|
||||||
|
tests/markers/test_function_scope.py | 31 ++++++++++++++++++++++++++++
|
||||||
|
3 files changed, 42 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/docs/source/reference/changelog.rst b/docs/source/reference/changelog.rst
|
||||||
|
index a55fb9a8..5f0de0a1 100644
|
||||||
|
--- a/docs/source/reference/changelog.rst
|
||||||
|
+++ b/docs/source/reference/changelog.rst
|
||||||
|
@@ -2,6 +2,15 @@
|
||||||
|
Changelog
|
||||||
|
=========
|
||||||
|
|
||||||
|
+0.23.8 (UNRELEASED)
|
||||||
|
+===================
|
||||||
|
+- Fixes a bug that caused duplicate markers in async tests `#813 <https://github.com/pytest-dev/pytest-asyncio/issues/813>`_
|
||||||
|
+
|
||||||
|
+Known issues
|
||||||
|
+------------
|
||||||
|
+As of v0.23, pytest-asyncio attaches an asyncio event loop to each item of the test suite (i.e. session, packages, modules, classes, functions) and allows tests to be run in those loops when marked accordingly. Pytest-asyncio currently assumes that async fixture scope is correlated with the new event loop scope. This prevents fixtures from being evaluated independently from the event loop scope and breaks some existing test suites (see `#706`_). For example, a test suite may require all fixtures and tests to run in the same event loop, but have async fixtures that are set up and torn down for each module. If you're affected by this issue, please continue using the v0.21 release, until it is resolved.
|
||||||
|
+
|
||||||
|
+
|
||||||
|
0.23.7 (2024-05-19)
|
||||||
|
===================
|
||||||
|
- Silence deprecation warnings about unclosed event loops that occurred with certain CPython patch releases `#817 <https://github.com/pytest-dev/pytest-asyncio/pull/817>`_
|
||||||
|
diff --git a/pytest_asyncio/plugin.py b/pytest_asyncio/plugin.py
|
||||||
|
index cd4c4ede..d3d1fcf7 100644
|
||||||
|
--- a/pytest_asyncio/plugin.py
|
||||||
|
+++ b/pytest_asyncio/plugin.py
|
||||||
|
@@ -405,7 +405,8 @@ def _from_function(cls, function: Function, /) -> Function:
|
||||||
|
keywords=function.keywords,
|
||||||
|
originalname=function.originalname,
|
||||||
|
)
|
||||||
|
- subclass_instance.own_markers.extend(function.own_markers)
|
||||||
|
+ subclass_instance.own_markers = function.own_markers
|
||||||
|
+ assert subclass_instance.own_markers == function.own_markers
|
||||||
|
subclassed_function_signature = inspect.signature(subclass_instance.obj)
|
||||||
|
if "event_loop" in subclassed_function_signature.parameters:
|
||||||
|
subclass_instance.warn(
|
||||||
|
diff --git a/tests/markers/test_function_scope.py b/tests/markers/test_function_scope.py
|
||||||
|
index 2057a128..eded4552 100644
|
||||||
|
--- a/tests/markers/test_function_scope.py
|
||||||
|
+++ b/tests/markers/test_function_scope.py
|
||||||
|
@@ -197,3 +197,34 @@ async def test_anything():
|
||||||
|
)
|
||||||
|
result = pytester.runpytest_subprocess("--asyncio-mode=strict")
|
||||||
|
result.assert_outcomes(warnings=0, passed=1)
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+def test_asyncio_mark_does_not_duplicate_other_marks_in_auto_mode(
|
||||||
|
+ pytester: Pytester,
|
||||||
|
+):
|
||||||
|
+ pytester.makeconftest(
|
||||||
|
+ dedent(
|
||||||
|
+ """\
|
||||||
|
+ def pytest_configure(config):
|
||||||
|
+ config.addinivalue_line(
|
||||||
|
+ "markers", "dummy_marker: mark used for testing purposes"
|
||||||
|
+ )
|
||||||
|
+ """
|
||||||
|
+ )
|
||||||
|
+ )
|
||||||
|
+ pytester.makepyfile(
|
||||||
|
+ dedent(
|
||||||
|
+ """\
|
||||||
|
+ import pytest
|
||||||
|
+
|
||||||
|
+ @pytest.mark.dummy_marker
|
||||||
|
+ async def test_markers_not_duplicated(request):
|
||||||
|
+ markers = []
|
||||||
|
+ for node, marker in request.node.iter_markers_with_node():
|
||||||
|
+ markers.append(marker)
|
||||||
|
+ assert len(markers) == 2
|
||||||
|
+ """
|
||||||
|
+ )
|
||||||
|
+ )
|
||||||
|
+ result = pytester.runpytest_subprocess("--asyncio-mode=auto")
|
||||||
|
+ result.assert_outcomes(warnings=0, passed=1)
|
@ -1,46 +0,0 @@
|
|||||||
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)
BIN
pytest-asyncio-0.21.1.tar.gz
(Stored with Git LFS)
Binary file not shown.
BIN
pytest-asyncio-0.23.7.tar.gz
(Stored with Git LFS)
Normal file
BIN
pytest-asyncio-0.23.7.tar.gz
(Stored with Git LFS)
Normal file
Binary file not shown.
@ -1,3 +1,101 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 9 13:43:10 UTC 2024 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
|
- Add duplicated-markers.patch to fix some testsuites broken by
|
||||||
|
that issue.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Jun 6 20:26:26 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 0.23.7:
|
||||||
|
* Silence deprecation warnings about unclosed event loops that
|
||||||
|
occurred with certain CPython patch releases
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Thu Mar 21 17:04:18 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 0.23.6:
|
||||||
|
* compatibiltiy with pytest 8.2
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Mar 16 09:46:24 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 0.23.5.post1:
|
||||||
|
* Declare compatibility with pytest 8
|
||||||
|
* Fix typing errors with recent versions of mypy #769
|
||||||
|
* Prevent DeprecationWarning about internal use of
|
||||||
|
`asyncio.get_event_loop()` from affecting test cases #757
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Mar 2 11:29:53 UTC 2024 - Ben Greiner <code@bnavigator.de>
|
||||||
|
|
||||||
|
- Update to 0.23.5
|
||||||
|
* Declare compatibility with pytest 8 #737
|
||||||
|
* Fix typing errors with recent versions of mypy #769
|
||||||
|
* Prevent DeprecationWarning about internal use of
|
||||||
|
asyncio.get_event_loop() from affecting test cases #757
|
||||||
|
## Known issues
|
||||||
|
* As of v0.23, pytest-asyncio attaches an asyncio event loop to
|
||||||
|
each item of the test suite (i.e. session, packages, modules,
|
||||||
|
classes, functions) and allows tests to be run in those loops
|
||||||
|
when marked accordingly. Pytest-asyncio currently assumes that
|
||||||
|
async fixture scope is correlated with the new event loop
|
||||||
|
scope. This prevents fixtures from being evaluated
|
||||||
|
independently from the event loop scope and breaks some
|
||||||
|
existing test suites (see #706). For example, a test suite may
|
||||||
|
require all fixtures and tests to run in the same event loop,
|
||||||
|
but have async fixtures that are set up and torn down for each
|
||||||
|
module. If you're affected by this issue, please continue using
|
||||||
|
the v0.21 release, until it is resolved.
|
||||||
|
- Release 0.23.4
|
||||||
|
* pytest-asyncio no longer imports additional, unrelated packages
|
||||||
|
during test collection #729
|
||||||
|
* Addresses further issues that caused an internal pytest error
|
||||||
|
during test collection
|
||||||
|
* Declares incompatibility with pytest 8 #737
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jan 2 12:01:57 UTC 2024 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- update to 0.23.3:
|
||||||
|
* Fixes a bug that caused event loops to be closed prematurely
|
||||||
|
when using async generator fixtures with class scope or wider
|
||||||
|
in a function-scoped test #706
|
||||||
|
* Fixes various bugs that caused an internal pytest error
|
||||||
|
during test collection #711 #713 #719
|
||||||
|
* Fixes a bug that caused an internal pytest error when
|
||||||
|
collecting .txt files
|
||||||
|
* Fixes a bug that caused an internal pytest error when using
|
||||||
|
module-level skips #701
|
||||||
|
This release is backwards-compatible with v0.21. Changes are
|
||||||
|
non-breaking, unless you upgrade from v0.22.
|
||||||
|
* BREAKING: The asyncio_event_loop mark has been removed.
|
||||||
|
Event loops with class, module, package, and session scopes
|
||||||
|
can be requested via the scope keyword argument to the
|
||||||
|
_asyncio_ mark. -
|
||||||
|
Introduces the event_loop_policy fixture which allows testing
|
||||||
|
with non-default or multiple event loops
|
||||||
|
* Introduces pytest_asyncio.is_async_test which returns whether
|
||||||
|
a test item is managed by pytest-asyncio
|
||||||
|
* Removes and pytest trio, mypy, and flaky from the test
|
||||||
|
dependencies
|
||||||
|
* Deprecate redefinition of the event_loop fixture. #587 Users
|
||||||
|
requiring a class-scoped or module-scoped asyncio event loop
|
||||||
|
for their tests should mark the corresponding class or module
|
||||||
|
with asyncio_event_loop.
|
||||||
|
* Test items based on asynchronous generators always exit with
|
||||||
|
xfail status and emit a warning during the collection phase.
|
||||||
|
This behavior is consistent with synchronous yield tests.
|
||||||
|
#642
|
||||||
|
* Remove support for Python 3.7
|
||||||
|
* Declare support for Python 3.12
|
||||||
|
- drop hypothesis-health-check.patch (upstream)
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Nov 7 19:34:40 UTC 2023 - Dirk Müller <dmueller@suse.com>
|
||||||
|
|
||||||
|
- remove unnecessary dependency on async_generator
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Oct 17 08:19:39 UTC 2023 - Markéta Machová <mmachova@suse.com>
|
Tue Oct 17 08:19:39 UTC 2023 - Markéta Machová <mmachova@suse.com>
|
||||||
|
|
||||||
@ -37,7 +135,7 @@ Thu Apr 13 22:43:58 UTC 2023 - Matej Cepl <mcepl@suse.com>
|
|||||||
Fri Dec 9 11:11:04 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
|
Fri Dec 9 11:11:04 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
|
|
||||||
- Update to 0.20.3:
|
- Update to 0.20.3:
|
||||||
* Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. #460
|
* 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>
|
Wed Nov 30 07:13:34 UTC 2022 - Daniel Garcia <daniel.garcia@suse.com>
|
||||||
@ -71,7 +169,7 @@ Fri Aug 5 04:57:24 UTC 2022 - John Vandenberg <jayvdb@gmail.com>
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jul 6 07:59:54 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
Wed Jul 6 07:59:54 UTC 2022 - Steve Kowalik <steven.kowalik@suse.com>
|
||||||
|
|
||||||
- Inject multibuild to defeat a build loop
|
- Inject multibuild to defeat a build loop
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue Jun 28 19:00:14 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
Tue Jun 28 19:00:14 UTC 2022 - Ben Greiner <code@bnavigator.de>
|
||||||
@ -193,4 +291,4 @@ Tue Sep 4 13:10:57 UTC 2018 - Ondřej Súkup <mimi.vx@gmail.com>
|
|||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri Jan 5 09:47:11 UTC 2018 - alarrosa@suse.com
|
Fri Jan 5 09:47:11 UTC 2018 - alarrosa@suse.com
|
||||||
|
|
||||||
- Initial release of python-pytest-asyncio 0.8.0
|
- Initial release of python-pytest-asyncio 0.8.0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file
|
# spec file for package python-pytest-asyncio
|
||||||
#
|
#
|
||||||
# Copyright (c) 2023 SUSE LLC
|
# Copyright (c) 2024 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -26,33 +26,30 @@
|
|||||||
%endif
|
%endif
|
||||||
%{?sle15_python_module_pythons}
|
%{?sle15_python_module_pythons}
|
||||||
Name: python-pytest-asyncio%{psuffix}
|
Name: python-pytest-asyncio%{psuffix}
|
||||||
Version: 0.21.1
|
Version: 0.23.7
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Pytest support for asyncio
|
Summary: Pytest support for asyncio
|
||||||
License: Apache-2.0
|
License: Apache-2.0
|
||||||
URL: https://github.com/pytest-dev/pytest-asyncio
|
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
|
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-FIX-UPSTREAM https://github.com/pytest-dev/pytest-asyncio/pull/838 Fix duplication of markers in async tests
|
||||||
Patch: hypothesis-health-check.patch
|
Patch: duplicated-markers.patch
|
||||||
BuildRequires: %{python_module base >= 3.7}
|
BuildRequires: %{python_module base >= 3.8}
|
||||||
BuildRequires: %{python_module pip}
|
BuildRequires: %{python_module pip}
|
||||||
BuildRequires: %{python_module setuptools_scm}
|
BuildRequires: %{python_module setuptools_scm}
|
||||||
BuildRequires: %{python_module setuptools}
|
BuildRequires: %{python_module setuptools}
|
||||||
BuildRequires: %{python_module wheel}
|
BuildRequires: %{python_module wheel}
|
||||||
BuildRequires: fdupes
|
BuildRequires: fdupes
|
||||||
BuildRequires: python-rpm-macros
|
BuildRequires: python-rpm-macros
|
||||||
Requires: python-pytest >= 7.0.0
|
Requires: (python-pytest >= 7.0.0 with python-pytest < 9)
|
||||||
%if 0%{?python_version_nodots} < 38
|
%if 0%{?python_version_nodots} < 38
|
||||||
Requires: python-typing-extensions >= 3.7.2
|
Requires: python-typing-extensions >= 3.7.2
|
||||||
%endif
|
%endif
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
%if %{with test}
|
%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 hypothesis >= 5.7.1}
|
||||||
BuildRequires: %{python_module pytest >= 7.0.0}
|
BuildRequires: %{python_module pytest >= 7.0.0 with %python-pytest < 9}
|
||||||
BuildRequires: %{python_module pytest-asyncio = %{version}}
|
BuildRequires: %{python_module pytest-asyncio = %{version}}
|
||||||
BuildRequires: %{python_module pytest-trio >= 0.7}
|
|
||||||
%endif
|
%endif
|
||||||
%python_subpackages
|
%python_subpackages
|
||||||
|
|
||||||
@ -87,7 +84,7 @@ export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
|
|||||||
%doc README.rst
|
%doc README.rst
|
||||||
%license LICENSE
|
%license LICENSE
|
||||||
%{python_sitelib}/pytest_asyncio
|
%{python_sitelib}/pytest_asyncio
|
||||||
%{python_sitelib}/pytest_asyncio-%{version}*-info
|
%{python_sitelib}/pytest_asyncio-%{version}.dist-info
|
||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
Loading…
Reference in New Issue
Block a user