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 2022-07-06 15:41:41
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/python-pytest-asyncio (Old)
and /work/SRC/openSUSE:Factory/.python-pytest-asyncio.new.1548 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-pytest-asyncio"
Wed Jul 6 15:41:41 2022 rev:10 rq:986981 version:0.18.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/python-pytest-asyncio/python-pytest-asyncio.changes
2022-01-23 16:25:41.388593393 +0100
+++
/work/SRC/openSUSE:Factory/.python-pytest-asyncio.new.1548/python-pytest-asyncio.changes
2022-07-06 15:41:45.138495370 +0200
@@ -1,0 +2,23 @@
+Wed Jul 6 07:59:54 UTC 2022 - Steve Kowalik <[email protected]>
+
+- Inject multibuild to defeat a build loop
+
+-------------------------------------------------------------------
+Tue Jun 28 19:00:14 UTC 2022 - Ben Greiner <[email protected]>
+
+- 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
+
+-------------------------------------------------------------------
Old:
----
pytest-asyncio-0.17.2.tar.gz
New:
----
_multibuild
pytest-asyncio-0.18.3.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ python-pytest-asyncio.spec ++++++
--- /var/tmp/diff_new_pack.KWJFpj/_old 2022-07-06 15:41:45.970496596 +0200
+++ /var/tmp/diff_new_pack.KWJFpj/_new 2022-07-06 15:41:45.974496602 +0200
@@ -1,5 +1,5 @@
#
-# spec file for package python-pytest-asyncio
+# spec file
#
# Copyright (c) 2022 SUSE LLC
#
@@ -16,29 +16,39 @@
#
-%define skip_python2 1
-%{?!python_module:%define python_module() python3-%{**}}
-Name: python-pytest-asyncio
-Version: 0.17.2
+%global flavor @BUILD_FLAVOR@%{nil}
+%if "%{flavor}" == "test"
+%define psuffix -test
+%bcond_without test
+%else
+%define psuffix %{nil}
+%bcond_with test
+%endif
+Name: python-pytest-asyncio%{psuffix}
+Version: 0.18.3
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
-BuildRequires: %{python_module async_generator >= 1.3}
BuildRequires: %{python_module base >= 3.7}
-BuildRequires: %{python_module flaky >= 3.5.0}
-BuildRequires: %{python_module hypothesis >= 5.7.1}
-BuildRequires: %{python_module pytest >= 6.1.0}
BuildRequires: %{python_module setuptools_scm}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-pytest >= 6.1.0
-%if 0%{python_version_nodots} < 38
-Requires: python-typing-extensions >= 4
+%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 >= 6.1.0}
+BuildRequires: %{python_module pytest-asyncio = %{version}}
+BuildRequires: %{python_module pytest-trio >= 0.7}
+%endif
%python_subpackages
%description
@@ -55,18 +65,24 @@
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%python_build
+%if !%{with test}
%install
export SETUPTOOLS_SCM_PRETEND_VERSION=%{version}
%python_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
++++++ _multibuild ++++++
<multibuild>
<package>test</package>
</multibuild>
++++++ pytest-asyncio-0.17.2.tar.gz -> pytest-asyncio-0.18.3.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/.github/workflows/main.yml
new/pytest-asyncio-0.18.3/.github/workflows/main.yml
--- old/pytest-asyncio-0.17.2/.github/workflows/main.yml 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/.github/workflows/main.yml 2022-03-25
10:22:08.000000000 +0100
@@ -17,12 +17,12 @@
version: ${{ steps.version.outputs.version }}
prerelease: ${{ steps.version.outputs.prerelease }}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v3
with:
- python-version: '3.9'
+ python-version: '3.10'
- name: Install GitHub matcher for ActionLint checker
run: |
echo "::add-matcher::.github/actionlint-matcher.json"
@@ -58,10 +58,10 @@
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v3
with:
fetch-depth: 0
- - uses: actions/setup-python@v2
+ - uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
@@ -103,7 +103,7 @@
run: |
sudo apt-get install -y pandoc
- name: Checkout
- uses: actions/[email protected]
+ uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Download distributions
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/CHANGELOG.rst
new/pytest-asyncio-0.18.3/CHANGELOG.rst
--- old/pytest-asyncio-0.17.2/CHANGELOG.rst 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-asyncio-0.18.3/CHANGELOG.rst 2022-03-25 10:22:08.000000000
+0100
@@ -0,0 +1,163 @@
+=========
+Changelog
+=========
+
+0.18.3 (22-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)
+=================
+- 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)
+=================
+- 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)
+=================
+
+- 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)
+=================
+
+- 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)
+=================
+- 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)
+=================
+- `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>`_
+- Added `flaky <https://pypi.org/project/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
<https://github.com/pytest-dev/pytest-asyncio/issues/99>`_
+- Added the plugin modes: *strict*, *auto*, and *legacy*. See `documentation
<https://github.com/pytest-dev/pytest-asyncio#modes>`_ for details. `#125
<https://github.com/pytest-dev/pytest-asyncio/issues/125>`_
+- Correctly process ``KeyboardInterrupt`` during async fixture setup phase
`#219 <https://github.com/pytest-dev/pytest-asyncio/issues/219>`_
+
+0.16.0 (2021-10-16)
+===================
+- Add support for Python 3.10
+
+0.15.1 (2021-04-22)
+===================
+- Hotfix for errors while closing event loops while replacing them.
+ `#209 <https://github.com/pytest-dev/pytest-asyncio/issues/209>`_
+ `#210 <https://github.com/pytest-dev/pytest-asyncio/issues/210>`_
+
+0.15.0 (2021-04-19)
+===================
+- 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 <https://github.com/pytest-dev/pytest-asyncio/pull/163>`_
+- Properly close event loops when replacing them.
+ `#208 <https://github.com/pytest-dev/pytest-asyncio/issues/208>`_
+
+0.14.0 (2020-06-24)
+===================
+- Fix `#162 <https://github.com/pytest-dev/pytest-asyncio/issues/162>`_, and
``event_loop`` fixture behavior now is coherent on all scopes.
+ `#164 <https://github.com/pytest-dev/pytest-asyncio/pull/164>`_
+
+0.12.0 (2020-05-04)
+===================
+- Run the event loop fixture as soon as possible. This helps with fixtures
that have an implicit dependency on the event loop.
+ `#156 <https://github.com/pytest-dev/pytest-asyncio/pull/156>`_
+
+0.11.0 (2020-04-20)
+===================
+- Test on 3.8, drop 3.3 and 3.4. Stick to 0.10 for these versions.
+ `#152 <https://github.com/pytest-dev/pytest-asyncio/pull/152>`_
+- Use the new Pytest 5.4.0 Function API. We therefore depend on pytest >=
5.4.0.
+ `#142 <https://github.com/pytest-dev/pytest-asyncio/pull/142>`_
+- Better ``pytest.skip`` support.
+ `#126 <https://github.com/pytest-dev/pytest-asyncio/pull/126>`_
+
+0.10.0 (2019-01-08)
+====================
+- ``pytest-asyncio`` integrates with `Hypothesis
<https://hypothesis.readthedocs.io>`_
+ to support ``@given`` on async test functions using ``asyncio``.
+ `#102 <https://github.com/pytest-dev/pytest-asyncio/pull/102>`_
+- Pytest 4.1 support.
+ `#105 <https://github.com/pytest-dev/pytest-asyncio/pull/105>`_
+
+0.9.0 (2018-07-28)
+==================
+- Python 3.7 support.
+- Remove ``event_loop_process_pool`` fixture and
+ ``pytest.mark.asyncio_process_pool`` marker (see
+ https://bugs.python.org/issue34075 for deprecation and removal details)
+
+0.8.0 (2017-09-23)
+==================
+- Improve integration with other packages (like aiohttp) with more careful
event loop handling.
+ `#64 <https://github.com/pytest-dev/pytest-asyncio/pull/64>`_
+
+0.7.0 (2017-09-08)
+==================
+- Python versions pre-3.6 can use the async_generator library for async
fixtures.
+ `#62 <https://github.com/pytest-dev/pytest-asyncio/pull/62>`
+
+0.6.0 (2017-05-28)
+==================
+- Support for Python versions pre-3.5 has been dropped.
+- ``pytestmark`` now works on both module and class level.
+- The ``forbid_global_loop`` parameter has been removed.
+- Support for async and async gen fixtures has been added.
+ `#45 <https://github.com/pytest-dev/pytest-asyncio/pull/45>`_
+- The deprecation warning regarding ``asyncio.async()`` has been fixed.
+ `#51 <https://github.com/pytest-dev/pytest-asyncio/pull/51>`_
+
+0.5.0 (2016-09-07)
+==================
+- Introduced a changelog.
+ `#31 <https://github.com/pytest-dev/pytest-asyncio/issues/31>`_
+- The ``event_loop`` fixture is again responsible for closing itself.
+ This makes the fixture slightly harder to correctly override, but enables
+ other fixtures to depend on it correctly.
+ `#30 <https://github.com/pytest-dev/pytest-asyncio/issues/30>`_
+- Deal with the event loop policy by wrapping a special pytest hook,
+ ``pytest_fixture_setup``. This allows setting the policy before fixtures
+ dependent on the ``event_loop`` fixture run, thus allowing them to take
+ advantage of the ``forbid_global_loop`` parameter. As a consequence of this,
+ we now depend on pytest 3.0.
+ `#29 <https://github.com/pytest-dev/pytest-asyncio/issues/29>`_
+
+0.4.1 (2016-06-01)
+==================
+- Fix a bug preventing the propagation of exceptions from the plugin.
+ `#25 <https://github.com/pytest-dev/pytest-asyncio/issues/25>`_
+
+0.4.0 (2016-05-30)
+==================
+- Make ``event_loop`` fixtures simpler to override by closing them in the
+ plugin, instead of directly in the fixture.
+ `#21 <https://github.com/pytest-dev/pytest-asyncio/pull/21>`_
+- Introduce the ``forbid_global_loop`` parameter.
+ `#21 <https://github.com/pytest-dev/pytest-asyncio/pull/21>`_
+
+0.3.0 (2015-12-19)
+==================
+- Support for Python 3.5 ``async``/``await`` syntax.
+ `#17 <https://github.com/pytest-dev/pytest-asyncio/pull/17>`_
+
+0.2.0 (2015-08-01)
+==================
+- ``unused_tcp_port_factory`` fixture.
+ `#10 <https://github.com/pytest-dev/pytest-asyncio/issues/10>`_
+
+0.1.1 (2015-04-23)
+==================
+Initial release.
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/MANIFEST.in
new/pytest-asyncio-0.18.3/MANIFEST.in
--- old/pytest-asyncio-0.17.2/MANIFEST.in 1970-01-01 01:00:00.000000000
+0100
+++ new/pytest-asyncio-0.18.3/MANIFEST.in 2022-03-25 10:22:08.000000000
+0100
@@ -0,0 +1,5 @@
+include CHANGELOG.rst
+
+recursive-exclude .github *
+exclude .gitignore
+exclude .pre-commit-config.yaml
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/README.rst
new/pytest-asyncio-0.18.3/README.rst
--- old/pytest-asyncio-0.17.2/README.rst 2022-01-17 16:12:56.000000000
+0100
+++ new/pytest-asyncio-0.18.3/README.rst 2022-03-25 10:22:08.000000000
+0100
@@ -69,7 +69,7 @@
[pytest]
asyncio_mode = auto
-The value can be overriden by command-line option for ``pytest`` invocation:
+The value can be overridden by command-line option for ``pytest`` invocation:
.. code-block:: bash
@@ -91,7 +91,7 @@
This mode requires the simplest tests and fixtures configuration and is
recommended for default usage *unless* the same project and its test suite
should
execute tests from different async frameworks, e.g. ``asyncio`` and ``trio``.
In this
-case, auto-handling can break tests designed for other framework; plase use
*strict*
+case, auto-handling can break tests designed for other framework; please use
*strict*
mode instead.
Strict mode
@@ -254,153 +254,6 @@
are recommended to use `unitest.IsolatedAsyncioTestCase
<https://docs.python.org/3/library/unittest.html#unittest.IsolatedAsyncioTestCase>`__
or an async framework such as `asynctest
<https://asynctest.readthedocs.io/en/latest>`__.
-Changelog
----------
-
-0.17.2 (22-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)
-~~~~~~~~~~~~~~~~~~~
-- 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)
-~~~~~~~~~~~~~~~~~~~
-- `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>`_
-- Added `flaky <https://pypi.org/project/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
<https://github.com/pytest-dev/pytest-asyncio/issues/99>`_
-- Added the plugin modes: *strict*, *auto*, and *legacy*. See `documentation
<https://github.com/pytest-dev/pytest-asyncio#modes>`_ for details. `#125
<https://github.com/pytest-dev/pytest-asyncio/issues/125>`_
-- Correctly process ``KeyboardInterrupt`` during async fixture setup phase
`#219 <https://github.com/pytest-dev/pytest-asyncio/issues/219>`_
-
-0.16.0 (2021-10-16)
-~~~~~~~~~~~~~~~~~~~
-- Add support for Python 3.10
-
-0.15.1 (2021-04-22)
-~~~~~~~~~~~~~~~~~~~
-- Hotfix for errors while closing event loops while replacing them.
- `#209 <https://github.com/pytest-dev/pytest-asyncio/issues/209>`_
- `#210 <https://github.com/pytest-dev/pytest-asyncio/issues/210>`_
-
-0.15.0 (2021-04-19)
-~~~~~~~~~~~~~~~~~~~
-- 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 <https://github.com/pytest-dev/pytest-asyncio/pull/163>`_
-- Properly close event loops when replacing them.
- `#208 <https://github.com/pytest-dev/pytest-asyncio/issues/208>`_
-
-0.14.0 (2020-06-24)
-~~~~~~~~~~~~~~~~~~~
-- Fix `#162 <https://github.com/pytest-dev/pytest-asyncio/issues/162>`_, and
``event_loop`` fixture behavior now is coherent on all scopes.
- `#164 <https://github.com/pytest-dev/pytest-asyncio/pull/164>`_
-
-0.12.0 (2020-05-04)
-~~~~~~~~~~~~~~~~~~~
-- Run the event loop fixture as soon as possible. This helps with fixtures
that have an implicit dependency on the event loop.
- `#156 <https://github.com/pytest-dev/pytest-asyncio/pull/156>`_
-
-0.11.0 (2020-04-20)
-~~~~~~~~~~~~~~~~~~~
-- Test on 3.8, drop 3.3 and 3.4. Stick to 0.10 for these versions.
- `#152 <https://github.com/pytest-dev/pytest-asyncio/pull/152>`_
-- Use the new Pytest 5.4.0 Function API. We therefore depend on pytest >=
5.4.0.
- `#142 <https://github.com/pytest-dev/pytest-asyncio/pull/142>`_
-- Better ``pytest.skip`` support.
- `#126 <https://github.com/pytest-dev/pytest-asyncio/pull/126>`_
-
-0.10.0 (2019-01-08)
-~~~~~~~~~~~~~~~~~~~~
-- ``pytest-asyncio`` integrates with `Hypothesis
<https://hypothesis.readthedocs.io>`_
- to support ``@given`` on async test functions using ``asyncio``.
- `#102 <https://github.com/pytest-dev/pytest-asyncio/pull/102>`_
-- Pytest 4.1 support.
- `#105 <https://github.com/pytest-dev/pytest-asyncio/pull/105>`_
-
-0.9.0 (2018-07-28)
-~~~~~~~~~~~~~~~~~~
-- Python 3.7 support.
-- Remove ``event_loop_process_pool`` fixture and
- ``pytest.mark.asyncio_process_pool`` marker (see
- https://bugs.python.org/issue34075 for deprecation and removal details)
-
-0.8.0 (2017-09-23)
-~~~~~~~~~~~~~~~~~~
-- Improve integration with other packages (like aiohttp) with more careful
event loop handling.
- `#64 <https://github.com/pytest-dev/pytest-asyncio/pull/64>`_
-
-0.7.0 (2017-09-08)
-~~~~~~~~~~~~~~~~~~
-- Python versions pre-3.6 can use the async_generator library for async
fixtures.
- `#62 <https://github.com/pytest-dev/pytest-asyncio/pull/62>`
-
-
-0.6.0 (2017-05-28)
-~~~~~~~~~~~~~~~~~~
-- Support for Python versions pre-3.5 has been dropped.
-- ``pytestmark`` now works on both module and class level.
-- The ``forbid_global_loop`` parameter has been removed.
-- Support for async and async gen fixtures has been added.
- `#45 <https://github.com/pytest-dev/pytest-asyncio/pull/45>`_
-- The deprecation warning regarding ``asyncio.async()`` has been fixed.
- `#51 <https://github.com/pytest-dev/pytest-asyncio/pull/51>`_
-
-0.5.0 (2016-09-07)
-~~~~~~~~~~~~~~~~~~
-- Introduced a changelog.
- `#31 <https://github.com/pytest-dev/pytest-asyncio/issues/31>`_
-- The ``event_loop`` fixture is again responsible for closing itself.
- This makes the fixture slightly harder to correctly override, but enables
- other fixtures to depend on it correctly.
- `#30 <https://github.com/pytest-dev/pytest-asyncio/issues/30>`_
-- Deal with the event loop policy by wrapping a special pytest hook,
- ``pytest_fixture_setup``. This allows setting the policy before fixtures
- dependent on the ``event_loop`` fixture run, thus allowing them to take
- advantage of the ``forbid_global_loop`` parameter. As a consequence of this,
- we now depend on pytest 3.0.
- `#29 <https://github.com/pytest-dev/pytest-asyncio/issues/29>`_
-
-
-0.4.1 (2016-06-01)
-~~~~~~~~~~~~~~~~~~
-- Fix a bug preventing the propagation of exceptions from the plugin.
- `#25 <https://github.com/pytest-dev/pytest-asyncio/issues/25>`_
-
-0.4.0 (2016-05-30)
-~~~~~~~~~~~~~~~~~~
-- Make ``event_loop`` fixtures simpler to override by closing them in the
- plugin, instead of directly in the fixture.
- `#21 <https://github.com/pytest-dev/pytest-asyncio/pull/21>`_
-- Introduce the ``forbid_global_loop`` parameter.
- `#21 <https://github.com/pytest-dev/pytest-asyncio/pull/21>`_
-
-0.3.0 (2015-12-19)
-~~~~~~~~~~~~~~~~~~
-- Support for Python 3.5 ``async``/``await`` syntax.
- `#17 <https://github.com/pytest-dev/pytest-asyncio/pull/17>`_
-
-0.2.0 (2015-08-01)
-~~~~~~~~~~~~~~~~~~
-- ``unused_tcp_port_factory`` fixture.
- `#10 <https://github.com/pytest-dev/pytest-asyncio/issues/10>`_
-
-
-0.1.1 (2015-04-23)
-~~~~~~~~~~~~~~~~~~
-Initial release.
-
-
Contributing
------------
Contributions are very welcome. Tests can be run with ``tox``, please ensure
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/pyproject.toml
new/pytest-asyncio-0.18.3/pyproject.toml
--- old/pytest-asyncio-0.17.2/pyproject.toml 2022-01-17 16:12:56.000000000
+0100
+++ new/pytest-asyncio-0.18.3/pyproject.toml 2022-03-25 10:22:08.000000000
+0100
@@ -2,7 +2,7 @@
requires = [
"setuptools>=51.0",
"wheel>=0.36",
- "setuptools_scm>=6.2"
+ "setuptools_scm[toml]>=6.2"
]
build-backend = "setuptools.build_meta"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/pytest_asyncio/plugin.py
new/pytest-asyncio-0.18.3/pytest_asyncio/plugin.py
--- old/pytest-asyncio-0.17.2/pytest_asyncio/plugin.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/pytest_asyncio/plugin.py 2022-03-25
10:22:08.000000000 +0100
@@ -165,7 +165,7 @@
def _is_coroutine(obj: Any) -> bool:
"""Check to see if an object is really an asyncio coroutine."""
- return asyncio.iscoroutinefunction(obj) or inspect.isgeneratorfunction(obj)
+ return asyncio.iscoroutinefunction(obj)
def _is_coroutine_or_asyncgen(obj: Any) -> bool:
@@ -198,6 +198,122 @@
return [f"asyncio: mode={mode}"]
+def _preprocess_async_fixtures(config: Config, holder: Set[FixtureDef]) ->
None:
+ asyncio_mode = _get_asyncio_mode(config)
+ fixturemanager = config.pluginmanager.get_plugin("funcmanage")
+ for fixtures in fixturemanager._arg2fixturedefs.values():
+ for fixturedef in fixtures:
+ if fixturedef is holder:
+ continue
+ func = fixturedef.func
+ if not _is_coroutine_or_asyncgen(func):
+ # Nothing to do with a regular fixture function
+ continue
+ if not _has_explicit_asyncio_mark(func):
+ if asyncio_mode == Mode.STRICT:
+ # Ignore async fixtures without explicit asyncio mark in
strict mode
+ # This applies to pytest_trio fixtures, for example
+ continue
+ elif asyncio_mode == Mode.AUTO:
+ # Enforce asyncio mode if 'auto'
+ _set_explicit_asyncio_mark(func)
+ elif asyncio_mode == Mode.LEGACY:
+ _set_explicit_asyncio_mark(func)
+ try:
+ code = func.__code__
+ except AttributeError:
+ code = func.__func__.__code__
+ name = (
+ f"<fixture {func.__qualname__},
file={code.co_filename}, "
+ f"line={code.co_firstlineno}>"
+ )
+ warnings.warn(
+ LEGACY_ASYNCIO_FIXTURE.format(name=name),
+ DeprecationWarning,
+ )
+
+ to_add = []
+ for name in ("request", "event_loop"):
+ if name not in fixturedef.argnames:
+ to_add.append(name)
+
+ if to_add:
+ fixturedef.argnames += tuple(to_add)
+
+ if inspect.isasyncgenfunction(func):
+ fixturedef.func = _wrap_asyncgen(func)
+ elif inspect.iscoroutinefunction(func):
+ fixturedef.func = _wrap_async(func)
+
+ assert _has_explicit_asyncio_mark(fixturedef.func)
+ holder.add(fixturedef)
+
+
+def _add_kwargs(
+ func: Callable[..., Any],
+ kwargs: Dict[str, Any],
+ event_loop: asyncio.AbstractEventLoop,
+ request: SubRequest,
+) -> Dict[str, Any]:
+ sig = inspect.signature(func)
+ ret = kwargs.copy()
+ if "request" in sig.parameters:
+ ret["request"] = request
+ if "event_loop" in sig.parameters:
+ ret["event_loop"] = event_loop
+ return ret
+
+
+def _wrap_asyncgen(func: Callable[..., AsyncIterator[_R]]) -> Callable[...,
_R]:
+ @functools.wraps(func)
+ def _asyncgen_fixture_wrapper(
+ event_loop: asyncio.AbstractEventLoop, request: SubRequest, **kwargs:
Any
+ ) -> _R:
+ gen_obj = func(**_add_kwargs(func, kwargs, event_loop, request))
+
+ async def setup() -> _R:
+ res = await gen_obj.__anext__()
+ return res
+
+ def finalizer() -> None:
+ """Yield again, to finalize."""
+
+ async def async_finalizer() -> None:
+ try:
+ await gen_obj.__anext__()
+ except StopAsyncIteration:
+ pass
+ else:
+ msg = "Async generator fixture didn't stop."
+ msg += "Yield only once."
+ raise ValueError(msg)
+
+ event_loop.run_until_complete(async_finalizer())
+
+ result = event_loop.run_until_complete(setup())
+ request.addfinalizer(finalizer)
+ return result
+
+ return _asyncgen_fixture_wrapper
+
+
+def _wrap_async(func: Callable[..., Awaitable[_R]]) -> Callable[..., _R]:
+ @functools.wraps(func)
+ def _async_fixture_wrapper(
+ event_loop: asyncio.AbstractEventLoop, request: SubRequest, **kwargs:
Any
+ ) -> _R:
+ async def setup() -> _R:
+ res = await func(**_add_kwargs(func, kwargs, event_loop, request))
+ return res
+
+ return event_loop.run_until_complete(setup())
+
+ return _async_fixture_wrapper
+
+
+_HOLDER: Set[FixtureDef] = set()
+
+
@pytest.mark.tryfirst
def pytest_pycollect_makeitem(
collector: Union[pytest.Module, pytest.Class], name: str, obj: object
@@ -207,13 +323,18 @@
"""A pytest hook to collect asyncio coroutines."""
if not collector.funcnamefilter(name):
return None
+ _preprocess_async_fixtures(collector.config, _HOLDER)
+ if isinstance(obj, staticmethod):
+ # staticmethods need to be unwrapped.
+ obj = obj.__func__
if (
_is_coroutine(obj)
or _is_hypothesis_test(obj)
and _hypothesis_test_wraps_coroutine(obj)
):
item = pytest.Function.from_parent(collector, name=name)
- if "asyncio" in item.keywords:
+ marker = item.get_closest_marker("asyncio")
+ if marker is not None:
return list(collector._genfunctions(name, obj))
else:
if _get_asyncio_mode(item.config) == Mode.AUTO:
@@ -229,32 +350,6 @@
return _is_coroutine(function.hypothesis.inner_test)
-class FixtureStripper:
- """Include additional Fixture, and then strip them"""
-
- REQUEST = "request"
- EVENT_LOOP = "event_loop"
-
- def __init__(self, fixturedef: FixtureDef) -> None:
- self.fixturedef = fixturedef
- self.to_strip: Set[str] = set()
-
- def add(self, name: str) -> None:
- """Add fixture name to fixturedef
- and record in to_strip list (If not previously included)"""
- if name in self.fixturedef.argnames:
- return
- self.fixturedef.argnames += (name,)
- self.to_strip.add(name)
-
- def get_and_strip_from(self, name: str, data_dict: Dict[str, _T]) -> _T:
- """Strip name from data, and return value"""
- result = data_dict[name]
- if name in self.to_strip:
- del data_dict[name]
- return result
-
-
@pytest.hookimpl(trylast=True)
def pytest_fixture_post_finalizer(fixturedef: FixtureDef, request: SubRequest)
-> None:
"""Called after fixture teardown"""
@@ -291,99 +386,6 @@
policy.set_event_loop(loop)
return
- func = fixturedef.func
- if not _is_coroutine_or_asyncgen(func):
- # Nothing to do with a regular fixture function
- yield
- return
-
- config = request.node.config
- asyncio_mode = _get_asyncio_mode(config)
-
- if not _has_explicit_asyncio_mark(func):
- if asyncio_mode == Mode.AUTO:
- # Enforce asyncio mode if 'auto'
- _set_explicit_asyncio_mark(func)
- elif asyncio_mode == Mode.LEGACY:
- _set_explicit_asyncio_mark(func)
- try:
- code = func.__code__
- except AttributeError:
- code = func.__func__.__code__
- name = (
- f"<fixture {func.__qualname__}, file={code.co_filename}, "
- f"line={code.co_firstlineno}>"
- )
- warnings.warn(
- LEGACY_ASYNCIO_FIXTURE.format(name=name),
- DeprecationWarning,
- )
- else:
- # asyncio_mode is STRICT,
- # don't handle fixtures that are not explicitly marked
- yield
- return
-
- if inspect.isasyncgenfunction(func):
- # This is an async generator function. Wrap it accordingly.
- generator = func
-
- fixture_stripper = FixtureStripper(fixturedef)
- fixture_stripper.add(FixtureStripper.EVENT_LOOP)
- fixture_stripper.add(FixtureStripper.REQUEST)
-
- def wrapper(*args, **kwargs):
- loop = fixture_stripper.get_and_strip_from(
- FixtureStripper.EVENT_LOOP, kwargs
- )
- request = fixture_stripper.get_and_strip_from(
- FixtureStripper.REQUEST, kwargs
- )
-
- gen_obj = generator(*args, **kwargs)
-
- async def setup():
- res = await gen_obj.__anext__()
- return res
-
- def finalizer():
- """Yield again, to finalize."""
-
- async def async_finalizer():
- try:
- await gen_obj.__anext__()
- except StopAsyncIteration:
- pass
- else:
- msg = "Async generator fixture didn't stop."
- msg += "Yield only once."
- raise ValueError(msg)
-
- loop.run_until_complete(async_finalizer())
-
- result = loop.run_until_complete(setup())
- request.addfinalizer(finalizer)
- return result
-
- fixturedef.func = wrapper
- elif inspect.iscoroutinefunction(func):
- coro = func
-
- fixture_stripper = FixtureStripper(fixturedef)
- fixture_stripper.add(FixtureStripper.EVENT_LOOP)
-
- def wrapper(*args, **kwargs):
- loop = fixture_stripper.get_and_strip_from(
- FixtureStripper.EVENT_LOOP, kwargs
- )
-
- async def setup():
- res = await coro(*args, **kwargs)
- return res
-
- return loop.run_until_complete(setup())
-
- fixturedef.func = wrapper
yield
@@ -395,16 +397,19 @@
Wraps marked tests in a synchronous function
where the wrapped test coroutine is executed in an event loop.
"""
- if "asyncio" in pyfuncitem.keywords:
+ marker = pyfuncitem.get_closest_marker("asyncio")
+ if marker is not None:
funcargs: Dict[str, object] = pyfuncitem.funcargs # type:
ignore[name-defined]
loop = cast(asyncio.AbstractEventLoop, funcargs["event_loop"])
if _is_hypothesis_test(pyfuncitem.obj):
pyfuncitem.obj.hypothesis.inner_test = wrap_in_sync(
+ pyfuncitem,
pyfuncitem.obj.hypothesis.inner_test,
_loop=loop,
)
else:
pyfuncitem.obj = wrap_in_sync(
+ pyfuncitem,
pyfuncitem.obj,
_loop=loop,
)
@@ -415,7 +420,11 @@
return getattr(function, "is_hypothesis_test", False)
-def wrap_in_sync(func: Callable[..., Awaitable[Any]], _loop:
asyncio.AbstractEventLoop):
+def wrap_in_sync(
+ pyfuncitem: pytest.Function,
+ func: Callable[..., Awaitable[Any]],
+ _loop: asyncio.AbstractEventLoop,
+):
"""Return a sync wrapper around an async function executing it in the
current event loop."""
@@ -427,36 +436,46 @@
func = raw_func
@functools.wraps(func)
- def inner(**kwargs):
- coro = func(**kwargs)
- if coro is not None:
- task = asyncio.ensure_future(coro, loop=_loop)
- try:
- _loop.run_until_complete(task)
- except BaseException:
- # run_until_complete doesn't get the result from exceptions
- # that are not subclasses of `Exception`. Consume all
- # exceptions to prevent asyncio's warning from logging.
- if task.done() and not task.cancelled():
- task.exception()
- raise
+ def inner(*args, **kwargs):
+ coro = func(*args, **kwargs)
+ if not inspect.isawaitable(coro):
+ pyfuncitem.warn(
+ pytest.PytestWarning(
+ f"The test {pyfuncitem} is marked with
'@pytest.mark.asyncio' "
+ "but it is not an async function. "
+ "Please remove asyncio marker. "
+ "If the test is not marked explicitly, "
+ "check for global markers applied via 'pytestmark'."
+ )
+ )
+ return
+ task = asyncio.ensure_future(coro, loop=_loop)
+ try:
+ _loop.run_until_complete(task)
+ except BaseException:
+ # run_until_complete doesn't get the result from exceptions
+ # that are not subclasses of `Exception`. Consume all
+ # exceptions to prevent asyncio's warning from logging.
+ if task.done() and not task.cancelled():
+ task.exception()
+ raise
inner._raw_test_func = func # type: ignore[attr-defined]
return inner
def pytest_runtest_setup(item: pytest.Item) -> None:
- if "asyncio" in item.keywords:
- fixturenames = item.fixturenames # type: ignore[attr-defined]
- # inject an event loop fixture for all async tests
- if "event_loop" in fixturenames:
- fixturenames.remove("event_loop")
- fixturenames.insert(0, "event_loop")
- obj = getattr(item, 'obj', None)
- if (
- item.get_closest_marker("asyncio") is not None
- and not getattr(obj, "hypothesis", False)
- and getattr(obj, "is_hypothesis_test", False)
+ marker = item.get_closest_marker("asyncio")
+ if marker is None:
+ return
+ fixturenames = item.fixturenames # type: ignore[attr-defined]
+ # inject an event loop fixture for all async tests
+ if "event_loop" in fixturenames:
+ fixturenames.remove("event_loop")
+ fixturenames.insert(0, "event_loop")
+ obj = getattr(item, "obj", None)
+ if not getattr(obj, "hypothesis", False) and getattr(
+ obj, "is_hypothesis_test", False
):
pytest.fail(
"test function `%r` is using Hypothesis, but pytest-asyncio "
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/setup.cfg
new/pytest-asyncio-0.18.3/setup.cfg
--- old/pytest-asyncio-0.17.2/setup.cfg 2022-01-17 16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/setup.cfg 2022-03-25 10:22:08.000000000 +0100
@@ -34,12 +34,9 @@
packages = find:
include_package_data = True
-setup_requires =
- setuptools_scm >= 6.2
-
install_requires =
pytest >= 6.1.0
- typing-extensions >= 4.0; python_version < "3.8"
+ typing-extensions >= 3.7.2; python_version < "3.8"
[options.extras_require]
testing =
@@ -47,6 +44,7 @@
hypothesis >= 5.7.1
flaky >= 3.5.0
mypy == 0.931
+ pytest-trio >= 0.7.0
[options.entry_points]
pytest11 =
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-asyncio-0.17.2/tests/async_fixtures/test_parametrized_loop.py
new/pytest-asyncio-0.18.3/tests/async_fixtures/test_parametrized_loop.py
--- old/pytest-asyncio-0.17.2/tests/async_fixtures/test_parametrized_loop.py
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/async_fixtures/test_parametrized_loop.py
2022-03-25 10:22:08.000000000 +0100
@@ -0,0 +1,31 @@
+import asyncio
+
+import pytest
+
+TESTS_COUNT = 0
+
+
+def teardown_module():
+ # parametrized 2 * 2 times: 2 for 'event_loop' and 2 for 'fix'
+ assert TESTS_COUNT == 4
+
+
[email protected](scope="module", params=[1, 2])
+def event_loop(request):
+ request.param
+ loop = asyncio.new_event_loop()
+ yield loop
+ loop.close()
+
+
[email protected](params=["a", "b"])
+async def fix(request):
+ await asyncio.sleep(0)
+ return request.param
+
+
[email protected]
+async def test_parametrized_loop(fix):
+ await asyncio.sleep(0)
+ global TESTS_COUNT
+ TESTS_COUNT += 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-asyncio-0.17.2/tests/loop_fixture_scope/conftest.py
new/pytest-asyncio-0.18.3/tests/loop_fixture_scope/conftest.py
--- old/pytest-asyncio-0.17.2/tests/loop_fixture_scope/conftest.py
1970-01-01 01:00:00.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/loop_fixture_scope/conftest.py
2022-03-25 10:22:08.000000000 +0100
@@ -0,0 +1,17 @@
+import asyncio
+
+import pytest
+
+
+class CustomSelectorLoop(asyncio.SelectorEventLoop):
+ """A subclass with no overrides, just to test for presence."""
+
+
+loop = CustomSelectorLoop()
+
+
[email protected](scope="module")
+def event_loop():
+ """Create an instance of the default event loop for each test case."""
+ yield loop
+ loop.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-asyncio-0.17.2/tests/loop_fixture_scope/test_loop_fixture_scope.py
new/pytest-asyncio-0.18.3/tests/loop_fixture_scope/test_loop_fixture_scope.py
---
old/pytest-asyncio-0.17.2/tests/loop_fixture_scope/test_loop_fixture_scope.py
1970-01-01 01:00:00.000000000 +0100
+++
new/pytest-asyncio-0.18.3/tests/loop_fixture_scope/test_loop_fixture_scope.py
2022-03-25 10:22:08.000000000 +0100
@@ -0,0 +1,16 @@
+"""Unit tests for overriding the event loop with a larger scoped one."""
+import asyncio
+
+import pytest
+
+
[email protected]
+async def test_for_custom_loop():
+ """This test should be executed using the custom loop."""
+ await asyncio.sleep(0.01)
+ assert type(asyncio.get_event_loop()).__name__ == "CustomSelectorLoop"
+
+
[email protected]
+async def test_dependent_fixture(dependent_fixture):
+ await asyncio.sleep(0.1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/modes/test_auto_mode.py
new/pytest-asyncio-0.18.3/tests/modes/test_auto_mode.py
--- old/pytest-asyncio-0.17.2/tests/modes/test_auto_mode.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/modes/test_auto_mode.py 2022-03-25
10:22:08.000000000 +0100
@@ -87,3 +87,53 @@
)
result = testdir.runpytest("--asyncio-mode=auto")
result.assert_outcomes(passed=1)
+
+
+def test_auto_mode_static_method(testdir):
+ testdir.makepyfile(
+ dedent(
+ """\
+ import asyncio
+
+ pytest_plugins = 'pytest_asyncio'
+
+
+ class TestA:
+
+ @staticmethod
+ async def test_a():
+ await asyncio.sleep(0)
+ """
+ )
+ )
+ result = testdir.runpytest("--asyncio-mode=auto")
+ result.assert_outcomes(passed=1)
+
+
+def test_auto_mode_static_method_fixture(testdir):
+ testdir.makepyfile(
+ dedent(
+ """\
+ import asyncio
+ import pytest
+
+ pytest_plugins = 'pytest_asyncio'
+
+
+ class TestA:
+
+ @staticmethod
+ @pytest.fixture
+ async def fixture_a():
+ await asyncio.sleep(0)
+ return 1
+
+ @staticmethod
+ async def test_a(fixture_a):
+ await asyncio.sleep(0)
+ assert fixture_a == 1
+ """
+ )
+ )
+ result = testdir.runpytest("--asyncio-mode=auto")
+ result.assert_outcomes(passed=1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/sessionloop/conftest.py
new/pytest-asyncio-0.18.3/tests/sessionloop/conftest.py
--- old/pytest-asyncio-0.17.2/tests/sessionloop/conftest.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/sessionloop/conftest.py 1970-01-01
01:00:00.000000000 +0100
@@ -1,17 +0,0 @@
-import asyncio
-
-import pytest
-
-
-class CustomSelectorLoopSession(asyncio.SelectorEventLoop):
- """A subclass with no overrides, just to test for presence."""
-
-
-loop = CustomSelectorLoopSession()
-
-
[email protected](scope="package")
-def event_loop():
- """Create an instance of the default event loop for each test case."""
- yield loop
- loop.close()
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/pytest-asyncio-0.17.2/tests/sessionloop/test_session_loops.py
new/pytest-asyncio-0.18.3/tests/sessionloop/test_session_loops.py
--- old/pytest-asyncio-0.17.2/tests/sessionloop/test_session_loops.py
2022-01-17 16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/sessionloop/test_session_loops.py
1970-01-01 01:00:00.000000000 +0100
@@ -1,16 +0,0 @@
-"""Unit tests for overriding the event loop with a session scoped one."""
-import asyncio
-
-import pytest
-
-
[email protected]
-async def test_for_custom_loop():
- """This test should be executed using the custom loop."""
- await asyncio.sleep(0.01)
- assert type(asyncio.get_event_loop()).__name__ ==
"CustomSelectorLoopSession"
-
-
[email protected]
-async def test_dependent_fixture(dependent_fixture):
- await asyncio.sleep(0.1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/test_asyncio_fixture.py
new/pytest-asyncio-0.18.3/tests/test_asyncio_fixture.py
--- old/pytest-asyncio-0.17.2/tests/test_asyncio_fixture.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/test_asyncio_fixture.py 2022-03-25
10:22:08.000000000 +0100
@@ -1,4 +1,5 @@
import asyncio
+from textwrap import dedent
import pytest
@@ -39,3 +40,25 @@
async def test_fixture_with_params(fixture_with_params):
await asyncio.sleep(0)
assert fixture_with_params % 2 == 0
+
+
[email protected]("mode", ("auto", "strict", "legacy"))
+def test_sync_function_uses_async_fixture(testdir, mode):
+ testdir.makepyfile(
+ dedent(
+ """\
+ import pytest_asyncio
+
+ pytest_plugins = 'pytest_asyncio'
+
+ @pytest_asyncio.fixture
+ async def always_true():
+ return True
+
+ def test_sync_function_uses_async_fixture(always_true):
+ assert always_true is True
+ """
+ )
+ )
+ result = testdir.runpytest(f"--asyncio-mode={mode}")
+ result.assert_outcomes(passed=1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/test_simple.py
new/pytest-asyncio-0.18.3/tests/test_simple.py
--- old/pytest-asyncio-0.17.2/tests/test_simple.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/test_simple.py 2022-03-25
10:22:08.000000000 +0100
@@ -1,5 +1,6 @@
"""Quick'n'dirty unit tests for provided fixtures and markers."""
import asyncio
+from textwrap import dedent
import pytest
@@ -26,14 +27,14 @@
@pytest.mark.xfail(reason="need a failure", strict=True)
@pytest.mark.asyncio
-def test_asyncio_marker_fail():
+async def test_asyncio_marker_fail():
raise AssertionError
@pytest.mark.asyncio
-def test_asyncio_marker_with_default_param(a_param=None):
+async def test_asyncio_marker_with_default_param(a_param=None):
"""Test the asyncio pytest marker."""
- yield # sleep(0)
+ await asyncio.sleep(0)
@pytest.mark.asyncio
@@ -240,3 +241,35 @@
def test_async_close_loop(event_loop):
event_loop.close()
return "ok"
+
+
+def test_warn_asyncio_marker_for_regular_func(testdir):
+ testdir.makepyfile(
+ dedent(
+ """\
+ import pytest
+
+ pytest_plugins = 'pytest_asyncio'
+
+ @pytest.mark.asyncio
+ def test_a():
+ pass
+ """
+ )
+ )
+ testdir.makefile(
+ ".ini",
+ pytest=dedent(
+ """\
+ [pytest]
+ asyncio_mode = strict
+ filterwarnings =
+ default
+ """
+ ),
+ )
+ result = testdir.runpytest()
+ result.assert_outcomes(passed=1)
+ result.stdout.fnmatch_lines(
+ ["*is marked with '@pytest.mark.asyncio' but it is not an async
function.*"]
+ )
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/test_subprocess.py
new/pytest-asyncio-0.18.3/tests/test_subprocess.py
--- old/pytest-asyncio-0.17.2/tests/test_subprocess.py 2022-01-17
16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/test_subprocess.py 2022-03-25
10:22:08.000000000 +0100
@@ -15,17 +15,20 @@
loop.close()
[email protected](forbid_global_loop=False)
-async def test_subprocess(event_loop):
- """Starting a subprocess should be possible."""
- proc = await asyncio.subprocess.create_subprocess_exec(
- sys.executable, "--version", stdout=asyncio.subprocess.PIPE
- )
- await proc.communicate()
-
[email protected](
+ sys.version_info < (3, 8),
+ reason="""
+ When run with Python 3.7 asyncio.subprocess.create_subprocess_exec
seems to be
+ affected by an issue that prevents correct cleanup. Tests using
pytest-trio
+ will report that signal handling is already performed by another
library and
+ fail. [1] This is possibly a bug in CPython 3.7, so we ignore this
test for
+ that Python version.
[email protected](forbid_global_loop=True)
-async def test_subprocess_forbid(event_loop):
+ [1] https://github.com/python-trio/pytest-trio/issues/126
+ """,
+)
[email protected]
+async def test_subprocess(event_loop):
"""Starting a subprocess should be possible."""
proc = await asyncio.subprocess.create_subprocess_exec(
sys.executable, "--version", stdout=asyncio.subprocess.PIPE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tests/trio/test_fixtures.py
new/pytest-asyncio-0.18.3/tests/trio/test_fixtures.py
--- old/pytest-asyncio-0.17.2/tests/trio/test_fixtures.py 1970-01-01
01:00:00.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tests/trio/test_fixtures.py 2022-03-25
10:22:08.000000000 +0100
@@ -0,0 +1,25 @@
+from textwrap import dedent
+
+
+def test_strict_mode_ignores_trio_fixtures(testdir):
+ testdir.makepyfile(
+ dedent(
+ """\
+ import pytest
+ import pytest_asyncio
+ import pytest_trio
+
+ pytest_plugins = ["pytest_asyncio", "pytest_trio"]
+
+ @pytest_trio.trio_fixture
+ async def any_fixture():
+ return True
+
+ @pytest.mark.trio
+ async def test_anything(any_fixture):
+ pass
+ """
+ )
+ )
+ result = testdir.runpytest("--asyncio-mode=strict")
+ result.assert_outcomes(passed=1)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/pytest-asyncio-0.17.2/tox.ini
new/pytest-asyncio-0.18.3/tox.ini
--- old/pytest-asyncio-0.17.2/tox.ini 2022-01-17 16:12:56.000000000 +0100
+++ new/pytest-asyncio-0.18.3/tox.ini 2022-03-25 10:22:08.000000000 +0100
@@ -1,7 +1,7 @@
[tox]
minversion = 3.14.0
envlist = py37, py38, py39, py310, lint, version-info, pytest-min
-skip_missing_interpreters = true
+isolated_build = true
passenv =
CI
@@ -22,7 +22,6 @@
make
[testenv:lint]
-skip_install = true
basepython = python3.10
extras = testing
deps =
@@ -40,7 +39,6 @@
coverage report
[testenv:version-info]
-basepython = python3.9
deps =
packaging == 21.3
commands =
@@ -50,6 +48,6 @@
python =
3.7: py37, pytest-min
3.8: py38
- 3.9: py39, lint
+ 3.9: py39
3.10: py310
pypy3: pypy3