From cc15bb87ff6380698e69ddbcda1e871b8b270295 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Tue, 6 Feb 2024 15:50:02 +0100 Subject: dev-python/pytest-asyncio: Add a pytest-8 fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- .../files/pytest-asyncio-0.23.4-pytest-8.patch | 47 ++++++++++++++++++ .../pytest-asyncio/pytest-asyncio-0.23.4-r1.ebuild | 57 ++++++++++++++++++++++ .../pytest-asyncio/pytest-asyncio-0.23.4.ebuild | 49 ------------------- 3 files changed, 104 insertions(+), 49 deletions(-) create mode 100644 dev-python/pytest-asyncio/files/pytest-asyncio-0.23.4-pytest-8.patch create mode 100644 dev-python/pytest-asyncio/pytest-asyncio-0.23.4-r1.ebuild delete mode 100644 dev-python/pytest-asyncio/pytest-asyncio-0.23.4.ebuild (limited to 'dev-python') diff --git a/dev-python/pytest-asyncio/files/pytest-asyncio-0.23.4-pytest-8.patch b/dev-python/pytest-asyncio/files/pytest-asyncio-0.23.4-pytest-8.patch new file mode 100644 index 000000000000..d18c5714005b --- /dev/null +++ b/dev-python/pytest-asyncio/files/pytest-asyncio-0.23.4-pytest-8.patch @@ -0,0 +1,47 @@ +From d53c12962fd7250bea28e03b5a141be73cfce06b Mon Sep 17 00:00:00 2001 +From: Arjan Keeman +Date: Tue, 6 Feb 2024 14:46:13 +0100 +Subject: [PATCH] fix compatibility with pytest ^8 + +diff --git a/setup.cfg b/setup.cfg +index 45d70b3..e8cbfc5 100644 +--- a/setup.cfg ++++ b/setup.cfg +@@ -40,5 +40,5 @@ include_package_data = True + install_requires = +- pytest >= 7.0.0,<8 ++ pytest >= 7.0.0, !=8.0.0rc1, !=8.0.0rc2 + + [options.extras_require] + testing = +diff --git a/tests/markers/test_session_scope.py b/tests/markers/test_session_scope.py +index bd0baee..9049c17 100644 +--- a/tests/markers/test_session_scope.py ++++ b/tests/markers/test_session_scope.py +@@ -44,7 +44,9 @@ def test_asyncio_mark_provides_session_scoped_loop_strict_mode(pytester: Pyteste + """ + ), + ) +- subpackage_name = "subpkg" ++ ++ # subpackage_name must alphabetically come after test_module_one.py ++ subpackage_name = "z_subpkg" + subpkg = pytester.mkpydir(subpackage_name) + subpkg.joinpath("test_subpkg.py").write_text( + dedent( +diff --git a/tests/test_is_async_test.py b/tests/test_is_async_test.py +index 512243b..12e791c 100644 +--- a/tests/test_is_async_test.py ++++ b/tests/test_is_async_test.py +@@ -77,8 +77,10 @@ def test_returns_false_for_unmarked_coroutine_item_in_strict_mode(pytester: Pyte + if pytest.version_tuple < (7, 2): + # Probably related to https://github.com/pytest-dev/pytest/pull/10012 + result.assert_outcomes(failed=1) +- else: ++ elif pytest.version_tuple < (8,): + result.assert_outcomes(skipped=1) ++ else: ++ result.assert_outcomes(failed=1) + + + def test_returns_true_for_unmarked_coroutine_item_in_auto_mode(pytester: Pytester): diff --git a/dev-python/pytest-asyncio/pytest-asyncio-0.23.4-r1.ebuild b/dev-python/pytest-asyncio/pytest-asyncio-0.23.4-r1.ebuild new file mode 100644 index 000000000000..22c4e61869b2 --- /dev/null +++ b/dev-python/pytest-asyncio/pytest-asyncio-0.23.4-r1.ebuild @@ -0,0 +1,57 @@ +# Copyright 2019-2024 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DISTUTILS_USE_PEP517=setuptools +PYPI_NO_NORMALIZE=1 +PYTHON_COMPAT=( python3_{10..12} pypy3 ) + +inherit distutils-r1 pypi + +DESCRIPTION="Library for testing asyncio code with pytest" +HOMEPAGE=" + https://github.com/pytest-dev/pytest-asyncio/ + https://pypi.org/project/pytest-asyncio/ +" + +LICENSE="Apache-2.0" +SLOT="0" +KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos" + +RDEPEND=" + >=dev-python/pytest-5.4.0[${PYTHON_USEDEP}] +" +BDEPEND=" + dev-python/setuptools-scm[${PYTHON_USEDEP}] + test? ( + >=dev-python/hypothesis-3.64[${PYTHON_USEDEP}] + ) +" + +distutils_enable_tests pytest + +PATCHES=( + # https://github.com/pytest-dev/pytest-asyncio/pull/776 + "${FILESDIR}/${P}-pytest-8.patch" +) + +python_test() { + local EPYTEST_DESELECT=( + # rely on precise warning counts + tests/hypothesis/test_base.py::test_can_use_explicit_event_loop_fixture + tests/modes/test_legacy_mode.py + tests/modes/test_strict_mode.py::test_strict_mode_ignores_unmarked_fixture + tests/test_event_loop_fixture_finalizer.py::test_event_loop_fixture_finalizer_raises_warning_when_fixture_leaves_loop_unclosed + tests/test_event_loop_fixture_finalizer.py::test_event_loop_fixture_finalizer_raises_warning_when_test_leaves_loop_unclosed + tests/test_pytest_min_version_warning.py + tests/trio/test_fixtures.py::test_strict_mode_ignores_trio_fixtures + + # TODO + tests/test_is_async_test.py::test_returns_false_for_unmarked_coroutine_item_in_strict_mode + ) + + local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 + local -x PYTEST_PLUGINS=pytest_asyncio.plugin,_hypothesis_pytestplugin + epytest +} diff --git a/dev-python/pytest-asyncio/pytest-asyncio-0.23.4.ebuild b/dev-python/pytest-asyncio/pytest-asyncio-0.23.4.ebuild deleted file mode 100644 index f54360ce4842..000000000000 --- a/dev-python/pytest-asyncio/pytest-asyncio-0.23.4.ebuild +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright 2019-2024 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -DISTUTILS_USE_PEP517=setuptools -PYPI_NO_NORMALIZE=1 -PYTHON_COMPAT=( python3_{10..12} pypy3 ) - -inherit distutils-r1 pypi - -DESCRIPTION="Library for testing asyncio code with pytest" -HOMEPAGE=" - https://github.com/pytest-dev/pytest-asyncio/ - https://pypi.org/project/pytest-asyncio/ -" - -LICENSE="Apache-2.0" -SLOT="0" -KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-macos" - -RDEPEND=" - >=dev-python/pytest-5.4.0[${PYTHON_USEDEP}] -" -BDEPEND=" - dev-python/setuptools-scm[${PYTHON_USEDEP}] - test? ( - >=dev-python/hypothesis-3.64[${PYTHON_USEDEP}] - ) -" - -distutils_enable_tests pytest - -python_test() { - local EPYTEST_DESELECT=( - # rely on precise warning counts - tests/hypothesis/test_base.py::test_can_use_explicit_event_loop_fixture - tests/modes/test_legacy_mode.py - tests/modes/test_strict_mode.py::test_strict_mode_ignores_unmarked_fixture - tests/test_event_loop_fixture_finalizer.py::test_event_loop_fixture_finalizer_raises_warning_when_fixture_leaves_loop_unclosed - tests/test_event_loop_fixture_finalizer.py::test_event_loop_fixture_finalizer_raises_warning_when_test_leaves_loop_unclosed - tests/test_pytest_min_version_warning.py - tests/trio/test_fixtures.py::test_strict_mode_ignores_trio_fixtures - ) - - local -x PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 - local -x PYTEST_PLUGINS=pytest_asyncio.plugin,_hypothesis_pytestplugin - epytest -} -- cgit v1.2.3