17
0

21 Commits

Author SHA256 Message Date
47fc0b7465 Accepting request 1186442 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/1186442
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=22
2024-07-10 14:48:00 +00:00
4ad6649829 - Add duplicated-markers.patch to fix some testsuites broken by
that issue.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-asyncio?expand=0&rev=46
2024-07-09 15:33:36 +00:00
5e476c6c7c Accepting request 1179085 from devel:languages:python:pytest
- update to 0.23.7:
  * Silence deprecation warnings about unclosed event loops that
    occurred with certain CPython patch releases

OBS-URL: https://build.opensuse.org/request/show/1179085
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=21
2024-06-07 13:01:51 +00:00
48d227f89e Accepting request 1160433 from devel:languages:python:pytest
- update to 0.23.6:
  * compatibiltiy with pytest 8.2

OBS-URL: https://build.opensuse.org/request/show/1160433
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=20
2024-03-26 18:24:21 +00:00
4f724d43ca Accepting request 1158427 from devel:languages:python:pytest
- 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

OBS-URL: https://build.opensuse.org/request/show/1158427
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=19
2024-03-18 15:44:07 +00:00
615a458611 Accepting request 1154886 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/1154886
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=18
2024-03-06 22:02:58 +00:00
06a166d79c Accepting request 1124081 from devel:languages:python:pytest
remove unnecessary dependency on async_generator

  * Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. #460
- Inject multibuild to defeat a build loop
- Initial release of python-pytest-asyncio 0.8.0

OBS-URL: https://build.opensuse.org/request/show/1124081
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=17
2023-11-08 21:17:08 +00:00
25b861864f Accepting request 1118228 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/1118228
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=16
2023-10-19 20:47:10 +00:00
5fba09db8b Accepting request 1100438 from devel:languages:python:pytest
- 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.

OBS-URL: https://build.opensuse.org/request/show/1100438
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=15
2023-07-26 11:21:39 +00:00
9a70025e21 Accepting request 1084898 from devel:languages:python:pytest
- 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.

OBS-URL: https://build.opensuse.org/request/show/1084898
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=14
2023-05-09 11:06:27 +00:00
faec3a4723 Accepting request 1082442 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/1082442
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=13
2023-04-25 14:53:40 +00:00
8593e6ef29 Accepting request 1041848 from devel:languages:python:pytest
- Update to 0.20.3:
  * Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. #460 
- 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

OBS-URL: https://build.opensuse.org/request/show/1041848
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=12
2022-12-12 17:59:12 +00:00
ce37f39229 Accepting request 993601 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/993601
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=11
2022-08-10 15:12:26 +00:00
433ac0ccce Accepting request 986981 from devel:languages:python:pytest
- Inject multibuild to defeat a build loop 

- 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

OBS-URL: https://build.opensuse.org/request/show/986981
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=10
2022-07-06 13:41:41 +00:00
6a8e358e1b Accepting request 947748 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/947748
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=9
2022-01-23 15:25:39 +00:00
03b3fdab64 Accepting request 926285 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/926285
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=8
2021-10-20 18:23:06 +00:00
84c282ef77 Accepting request 904060 from devel:languages:python:pytest
OBS-URL: https://build.opensuse.org/request/show/904060
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=7
2021-07-10 20:54:00 +00:00
92a94a53b5 Accepting request 817722 from devel:languages:python:pytest
- Update to 0.14.0
  * Fix #162, and event_loop fixture behavior now is coherent on all scopes.

OBS-URL: https://build.opensuse.org/request/show/817722
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=6
2020-06-30 19:54:46 +00:00
badd4634c7 Accepting request 812821 from devel:languages:python:pytest
- Update to 0.12.0:
  * Run the event loop fixture as soon as possible.

- Update to 0.11.0:
  * Fix with pytest 5.4

OBS-URL: https://build.opensuse.org/request/show/812821
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=5
2020-06-11 12:45:39 +00:00
5df94c6228 Accepting request 782858 from devel:languages:python:pytest
py38 fix

OBS-URL: https://build.opensuse.org/request/show/782858
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=4
2020-03-09 10:42:37 +00:00
93498edb4c Accepting request 674560 from devel:languages:python:pytest
- Update to 0.10.0:
  * support for pytest 4+

OBS-URL: https://build.opensuse.org/request/show/674560
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-pytest-asyncio?expand=0&rev=3
2019-02-14 13:34:22 +00:00
3 changed files with 94 additions and 0 deletions

86
duplicated-markers.patch Normal file
View 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)

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
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>

View File

@@ -32,6 +32,8 @@ 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/pull/838 Fix duplication of markers in async tests
Patch: duplicated-markers.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module setuptools_scm}