Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package python-pytest-asyncio for openSUSE:Factory checked in at 2023-07-26 13:21:39 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-pytest-asyncio (Old) and /work/SRC/openSUSE:Factory/.python-pytest-asyncio.new.15225 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-asyncio" Wed Jul 26 13:21:39 2023 rev:15 rq:1100438 version:0.21.1 Changes: -------- --- /work/SRC/openSUSE:Factory/python-pytest-asyncio/python-pytest-asyncio.changes 2023-05-09 13:06:35.880756774 +0200 +++ /work/SRC/openSUSE:Factory/.python-pytest-asyncio.new.15225/python-pytest-asyncio.changes 2023-07-26 13:21:45.827252110 +0200 @@ -1,0 +2,11 @@ +Mon Jul 24 18:40:25 UTC 2023 - Dirk Müller <dmuel...@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. + +------------------------------------------------------------------- Old: ---- pytest-asyncio-0.21.0.tar.gz New: ---- pytest-asyncio-0.21.1.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-pytest-asyncio.spec ++++++ --- /var/tmp/diff_new_pack.5Ik13A/_old 2023-07-26 13:21:46.527256072 +0200 +++ /var/tmp/diff_new_pack.5Ik13A/_new 2023-07-26 13:21:46.531256094 +0200 @@ -26,7 +26,7 @@ %endif %{?sle15_python_module_pythons} Name: python-pytest-asyncio%{psuffix} -Version: 0.21.0 +Version: 0.21.1 Release: 0 Summary: Pytest support for asyncio License: Apache-2.0 ++++++ pytest-asyncio-0.21.0.tar.gz -> pytest-asyncio-0.21.1.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/.github/dependabot.yml new/pytest-asyncio-0.21.1/.github/dependabot.yml --- old/pytest-asyncio-0.21.0/.github/dependabot.yml 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/.github/dependabot.yml 2023-07-12 12:06:27.000000000 +0200 @@ -6,7 +6,7 @@ schedule: interval: weekly open-pull-requests-limit: 10 - target-branch: master + target-branch: main - package-ecosystem: github-actions directory: / schedule: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/.github/workflows/main.yml new/pytest-asyncio-0.21.1/.github/workflows/main.yml --- old/pytest-asyncio-0.21.0/.github/workflows/main.yml 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/.github/workflows/main.yml 2023-07-12 12:06:27.000000000 +0200 @@ -3,10 +3,10 @@ on: push: - branches: [master] + branches: [main] tags: [v*] pull_request: - branches: [master] + branches: [main] workflow_dispatch: env: @@ -68,7 +68,7 @@ if: "!endsWith(matrix.python-version, '-dev')" with: python-version: ${{ matrix.python-version }} - - uses: deadsnakes/action@v3.0.0 + - uses: deadsnakes/action@v3.0.1 if: endsWith(matrix.python-version, '-dev') with: python-version: ${{ matrix.python-version }} @@ -145,7 +145,7 @@ run: | pandoc -s -o README.md README.rst - name: PyPI upload - uses: pypa/gh-action-pypi-publish@v1.8.1 + uses: pypa/gh-action-pypi-publish@v1.8.8 with: packages_dir: dist password: ${{ secrets.PYPI_API_TOKEN }} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/README.rst new/pytest-asyncio-0.21.1/README.rst --- old/pytest-asyncio-0.21.0/README.rst 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/README.rst 2023-07-12 12:06:27.000000000 +0200 @@ -5,7 +5,7 @@ :target: https://pypi.python.org/pypi/pytest-asyncio .. image:: https://github.com/pytest-dev/pytest-asyncio/workflows/CI/badge.svg :target: https://github.com/pytest-dev/pytest-asyncio/actions?workflow=CI -.. image:: https://codecov.io/gh/pytest-dev/pytest-asyncio/branch/master/graph/badge.svg +.. image:: https://codecov.io/gh/pytest-dev/pytest-asyncio/branch/main/graph/badge.svg :target: https://codecov.io/gh/pytest-dev/pytest-asyncio .. image:: https://img.shields.io/pypi/pyversions/pytest-asyncio.svg :target: https://github.com/pytest-dev/pytest-asyncio @@ -31,7 +31,7 @@ or an async framework such as `asynctest <https://asynctest.readthedocs.io/en/latest>`__. -pytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/master/LICENSE>`_. +pytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/main/LICENSE>`_. Installation diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/dependencies/default/constraints.txt new/pytest-asyncio-0.21.1/dependencies/default/constraints.txt --- old/pytest-asyncio-0.21.0/dependencies/default/constraints.txt 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/dependencies/default/constraints.txt 2023-07-12 12:06:27.000000000 +0200 @@ -1,24 +1,24 @@ async-generator==1.10 -attrs==22.2.0 -coverage==7.2.1 -exceptiongroup==1.1.1 +attrs==23.1.0 +coverage==7.2.7 +exceptiongroup==1.1.2 flaky==3.7.0 -hypothesis==6.68.2 +hypothesis==6.79.4 idna==3.4 -importlib-metadata==6.0.0 +importlib-metadata==6.7.0 iniconfig==2.0.0 -mypy==1.1.1 +mypy==1.4.1 mypy-extensions==1.0.0 outcome==1.2.0 -packaging==23.0 -pluggy==1.0.0 -pyparsing==3.0.9 -pytest==7.2.2 +packaging==23.1 +pluggy==1.2.0 +pyparsing==3.1.0 +pytest==7.4.0 pytest-trio==0.8.0 sniffio==1.3.0 sortedcontainers==2.4.0 tomli==2.0.1 -trio==0.22.0 -typed-ast==1.5.4 -typing_extensions==4.5.0 +trio==0.22.1 +typed-ast==1.5.5 +typing_extensions==4.7.1 zipp==3.15.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/docs/source/index.rst new/pytest-asyncio-0.21.1/docs/source/index.rst --- old/pytest-asyncio-0.21.0/docs/source/index.rst 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/docs/source/index.rst 2023-07-12 12:06:27.000000000 +0200 @@ -27,4 +27,4 @@ or an async framework such as `asynctest <https://asynctest.readthedocs.io/en/latest>`__. -pytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/master/LICENSE>`_. +pytest-asyncio is available under the `Apache License 2.0 <https://github.com/pytest-dev/pytest-asyncio/blob/main/LICENSE>`_. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/docs/source/reference/changelog.rst new/pytest-asyncio-0.21.1/docs/source/reference/changelog.rst --- old/pytest-asyncio-0.21.0/docs/source/reference/changelog.rst 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/docs/source/reference/changelog.rst 2023-07-12 12:06:27.000000000 +0200 @@ -2,77 +2,84 @@ Changelog ========= -0.21.0 (23-03-19) -================= +0.21.1 (2023-07-12) +=================== +- Output a proper error message when an invalid ``asyncio_mode`` is selected. +- Extend warning message about unclosed event loops with additional possible cause. + `#531 <https://github.com/pytest-dev/pytest-asyncio/issues/531>`_ +- Previously, some tests reported "skipped" or "xfailed" as a result. Now all tests report a "success" result. + +0.21.0 (2023-03-19) +=================== - 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. This behavior has been deprecated and pytest-asyncio emits a DeprecationWarning when tearing down the event_loop fixture and current event loop has not been closed. -0.20.3 (22-12-08) -================= +0.20.3 (2022-12-08) +=================== - Prevent DeprecationWarning to bubble up on CPython 3.10.9 and 3.11.1. `#460 <https://github.com/pytest-dev/pytest-asyncio/issues/460>`_ -0.20.2 (22-11-11) -================= +0.20.2 (2022-11-11) +=================== - Fixes an issue with async fixtures that are defined as methods on a test class not being rebound to the actual test instance. `#197 <https://github.com/pytest-dev/pytest-asyncio/issues/197>`_ - Replaced usage of deprecated ``@pytest.mark.tryfirst`` with ``@pytest.hookimpl(tryfirst=True)`` `#438 <https://github.com/pytest-dev/pytest-asyncio/pull/438>`_ -0.20.1 (22-10-21) -================= +0.20.1 (2022-10-21) +=================== - Fixes an issue that warned about using an old version of pytest, even though the most recent version was installed. `#430 <https://github.com/pytest-dev/pytest-asyncio/issues/430>`_ -0.20.0 (22-10-21) -================= +0.20.0 (2022-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 <https://github.com/pytest-dev/pytest-asyncio/pull/404>`_ -0.19.0 (22-07-13) -================= +0.19.0 (2022-07-13) +=================== - BREAKING: The default ``asyncio_mode`` is now *strict*. `#293 <https://github.com/pytest-dev/pytest-asyncio/issues/293>`_ - Removes `setup.py` since all relevant configuration is present `setup.cfg`. Users requiring an editable installation of pytest-asyncio need to use pip v21.1 or newer. `#283 <https://github.com/pytest-dev/pytest-asyncio/issues/283>`_ - Declare support for Python 3.11. -0.18.3 (22-03-25) -================= +0.18.3 (2022-03-25) +=================== - Adds `pytest-trio <https://pypi.org/project/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 <https://github.com/pytest-dev/pytest-asyncio/issues/298>`_ -0.18.2 (22-03-03) -================= +0.18.2 (2022-03-03) +=================== - Fix asyncio auto mode not marking static methods. `#295 <https://github.com/pytest-dev/pytest-asyncio/issues/295>`_ - Fix a compatibility issue with Hypothesis 6.39.0. `#302 <https://github.com/pytest-dev/pytest-asyncio/issues/302>`_ -0.18.1 (22-02-10) -================= +0.18.1 (2022-02-10) +=================== - Fixes a regression that prevented async fixtures from working in synchronous tests. `#286 <https://github.com/pytest-dev/pytest-asyncio/issues/286>`_ -0.18.0 (22-02-07) -================= +0.18.0 (2022-02-07) +=================== - Raise a warning if @pytest.mark.asyncio is applied to non-async function. `#275 <https://github.com/pytest-dev/pytest-asyncio/issues/275>`_ - Support parametrized ``event_loop`` fixture. `#278 <https://github.com/pytest-dev/pytest-asyncio/issues/278>`_ -0.17.2 (22-01-17) -================= +0.17.2 (2022-01-17) +=================== - Require ``typing-extensions`` on Python<3.8 only. `#269 <https://github.com/pytest-dev/pytest-asyncio/issues/269>`_ - Fix a regression in tests collection introduced by 0.17.1, the plugin works fine with non-python tests again. `#267 <https://github.com/pytest-dev/pytest-asyncio/issues/267>`_ -0.17.1 (22-01-16) -================= +0.17.1 (2022-01-16) +=================== - Fixes a bug that prevents async Hypothesis tests from working without explicit ``asyncio`` marker when ``--asyncio-mode=auto`` is set. `#258 <https://github.com/pytest-dev/pytest-asyncio/issues/258>`_ - Fixed a bug that closes the default event loop if the loop doesn't exist `#257 <https://github.com/pytest-dev/pytest-asyncio/issues/257>`_ - Added type annotations. `#198 <https://github.com/pytest-dev/pytest-asyncio/issues/198>`_ - Show asyncio mode in pytest report headers. `#266 <https://github.com/pytest-dev/pytest-asyncio/issues/266>`_ - Relax ``asyncio_mode`` type definition; it allows to support pytest 6.1+. `#262 <https://github.com/pytest-dev/pytest-asyncio/issues/262>`_ -0.17.0 (22-01-13) -================= +0.17.0 (2022-01-13) +=================== - `pytest-asyncio` no longer alters existing event loop policies. `#168 <https://github.com/pytest-dev/pytest-asyncio/issues/168>`_, `#188 <https://github.com/pytest-dev/pytest-asyncio/issues/168>`_ - Drop support for Python 3.6 - Fixed an issue when pytest-asyncio was used in combination with `flaky` or inherited asynchronous Hypothesis tests. `#178 <https://github.com/pytest-dev/pytest-asyncio/issues/178>`_ `#231 <https://github.com/pytest-dev/pytest-asyncio/issues/231>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/docs/source/reference/fixtures.rst new/pytest-asyncio-0.21.1/docs/source/reference/fixtures.rst --- old/pytest-asyncio-0.21.0/docs/source/reference/fixtures.rst 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/docs/source/reference/fixtures.rst 2023-07-12 12:06:27.000000000 +0200 @@ -2,8 +2,8 @@ Fixtures ======== -``event_loop`` -============== +event_loop +========== Creates a new asyncio event loop based on the current event loop policy. The new loop is available as the return value of this fixture or via `asyncio.get_running_loop <https://docs.python.org/3/library/asyncio-eventloop.html#asyncio.get_running_loop>`__. The event loop is closed when the fixture scope ends. The fixture scope defaults @@ -25,25 +25,30 @@ .. code-block:: python - @pytest.fixture(scope="session") + @pytest.fixture(scope="module") def event_loop(): policy = asyncio.get_event_loop_policy() loop = policy.new_event_loop() yield loop loop.close() +When defining multiple ``event_loop`` fixtures, you should ensure that their scopes don't overlap. +Each of the fixtures replace the running event loop, potentially without proper clean up. +This will emit a warning and likely lead to errors in your tests suite. +You can manually check for overlapping ``event_loop`` fixtures by running pytest with the ``--setup-show`` option. + If you need to change the type of the event loop, prefer setting a custom event loop policy over redefining the ``event_loop`` fixture. If the ``pytest.mark.asyncio`` decorator is applied to a test function, the ``event_loop`` fixture will be requested automatically by the test function. -``unused_tcp_port`` -=================== +unused_tcp_port +=============== Finds and yields a single unused TCP port on the localhost interface. Useful for binding temporary test servers. -``unused_tcp_port_factory`` -=========================== +unused_tcp_port_factory +======================= A callable which returns a different unused TCP port each invocation. Useful when several unused TCP ports are required in a test. @@ -53,6 +58,6 @@ port1, port2 = unused_tcp_port_factory(), unused_tcp_port_factory() ... -``unused_udp_port`` and ``unused_udp_port_factory`` -=================================================== +unused_udp_port and unused_udp_port_factory +=========================================== Works just like their TCP counterparts but returns unused UDP ports. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/pytest_asyncio/plugin.py new/pytest-asyncio-0.21.1/pytest_asyncio/plugin.py --- old/pytest-asyncio-0.21.0/pytest_asyncio/plugin.py 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/pytest_asyncio/plugin.py 2023-07-12 12:06:27.000000000 +0200 @@ -164,7 +164,13 @@ val = config.getoption("asyncio_mode") if val is None: val = config.getini("asyncio_mode") - return Mode(val) + try: + return Mode(val) + except ValueError: + modes = ", ".join(m.value for m in Mode) + raise pytest.UsageError( + f"{val!r} is not a valid asyncio_mode. Valid modes: {modes}." + ) def pytest_configure(config: Config) -> None: @@ -428,7 +434,8 @@ library will no longer do so. In order to ensure compatibility with future versions, please make sure that: 1. Any custom "event_loop" fixture properly closes the loop after yielding it - 2. Your code does not modify the event loop in async fixtures or tests + 2. The scopes of your custom "event_loop" fixtures do not overlap + 3. Your code does not modify the event loop in async fixtures or tests """ ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/setup.cfg new/pytest-asyncio-0.21.1/setup.cfg --- old/pytest-asyncio-0.21.0/setup.cfg 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/setup.cfg 2023-07-12 12:06:27.000000000 +0200 @@ -70,7 +70,8 @@ testpaths = tests asyncio_mode = auto junit_family=xunit2 -filterwarnings = error +filterwarnings = + error [flake8] max-line-length = 88 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pytest-asyncio-0.21.0/tests/test_simple.py new/pytest-asyncio-0.21.1/tests/test_simple.py --- old/pytest-asyncio-0.21.0/tests/test_simple.py 2023-03-19 11:07:34.000000000 +0100 +++ new/pytest-asyncio-0.21.1/tests/test_simple.py 2023-07-12 12:06:27.000000000 +0200 @@ -3,6 +3,7 @@ from textwrap import dedent import pytest +from pytest import Pytester import pytest_asyncio.plugin @@ -25,10 +26,41 @@ await asyncio.sleep(0) -@pytest.mark.xfail(reason="need a failure", strict=True) -@pytest.mark.asyncio -async def test_asyncio_marker_fail(): - raise AssertionError +def test_asyncio_marker_compatibility_with_xfail(pytester: Pytester): + pytester.makepyfile( + dedent( + """\ + import pytest + + pytest_plugins = "pytest_asyncio" + + @pytest.mark.xfail(reason="need a failure", strict=True) + @pytest.mark.asyncio + async def test_asyncio_marker_fail(): + raise AssertionError + """ + ) + ) + result = pytester.runpytest("--asyncio-mode=strict") + result.assert_outcomes(xfailed=1) + + +def test_asyncio_auto_mode_compatibility_with_xfail(pytester: Pytester): + pytester.makepyfile( + dedent( + """\ + import pytest + + pytest_plugins = "pytest_asyncio" + + @pytest.mark.xfail(reason="need a failure", strict=True) + async def test_asyncio_marker_fail(): + raise AssertionError + """ + ) + ) + result = pytester.runpytest("--asyncio-mode=auto") + result.assert_outcomes(xfailed=1) @pytest.mark.asyncio @@ -233,13 +265,39 @@ assert await loop.run_in_executor(None, self.foo) == 1 -@pytest.mark.asyncio -async def test_no_warning_on_skip(): - pytest.skip("Test a skip error inside asyncio") +def test_asyncio_marker_compatibility_with_skip(pytester: Pytester): + pytester.makepyfile( + dedent( + """\ + import pytest + + pytest_plugins = "pytest_asyncio" + + @pytest.mark.asyncio + async def test_no_warning_on_skip(): + pytest.skip("Test a skip error inside asyncio") + """ + ) + ) + result = pytester.runpytest("--asyncio-mode=strict") + result.assert_outcomes(skipped=1) -def test_async_close_loop(event_loop): - event_loop.close() +def test_asyncio_auto_mode_compatibility_with_skip(pytester: Pytester): + pytester.makepyfile( + dedent( + """\ + import pytest + + pytest_plugins = "pytest_asyncio" + + async def test_no_warning_on_skip(): + pytest.skip("Test a skip error inside asyncio") + """ + ) + ) + result = pytester.runpytest("--asyncio-mode=auto") + result.assert_outcomes(skipped=1) def test_warn_asyncio_marker_for_regular_func(testdir): @@ -272,3 +330,11 @@ result.stdout.fnmatch_lines( ["*is marked with '@pytest.mark.asyncio' but it is not an async function.*"] ) + + +def test_invalid_asyncio_mode(testdir): + result = testdir.runpytest("-o", "asyncio_mode=True") + result.stderr.no_fnmatch_line("INTERNALERROR> *") + result.stderr.fnmatch_lines( + "ERROR: 'True' is not a valid asyncio_mode. Valid modes: auto, strict." + )