From fc689ef5d902675cfd6eedc6980701b4a7bcdf57 Mon Sep 17 00:00:00 2001 From: Louis Sautier Date: Sat, 17 Oct 2020 11:20:58 +0200 Subject: [PATCH] dev-python/alembic: bump to 1.4.3, support PyPy3 and Python 3.9 Also: * Fix tests with pytest 6. * Update HOMEPAGE. * Use distutils_enable_tests. Package-Manager: Portage-3.0.8, Repoman-3.0.1 Signed-off-by: Louis Sautier --- dev-python/alembic/Manifest | 1 + dev-python/alembic/alembic-1.4.3.ebuild | 45 +++++++++++++ .../alembic/files/alembic-1.4.3-pytest6.patch | 66 +++++++++++++++++++ 3 files changed, 112 insertions(+) create mode 100644 dev-python/alembic/alembic-1.4.3.ebuild create mode 100644 dev-python/alembic/files/alembic-1.4.3-pytest6.patch diff --git a/dev-python/alembic/Manifest b/dev-python/alembic/Manifest index 13fd1fccd5e24..1e0a60fc54a44 100644 --- a/dev-python/alembic/Manifest +++ b/dev-python/alembic/Manifest @@ -1 +1,2 @@ DIST alembic-1.4.2.tar.gz 1092045 BLAKE2B 5f4001a756aacbb4db509669bc0d4d7c59c38e2983c433283243efa97bf28a22e38bcfd28a4bc72573e8ab78d6590e78f4e12a5b9dd08b60cf5a84520b955056 SHA512 82bdfe442c19033aa2b802ec49edd13ed265c00a2b5a048490a83ffa8e53587c56a90b64d554e746a9189923419c528482cb7a7c950c210e0de47b32fa7c270e +DIST alembic-1.4.3.tar.gz 1108131 BLAKE2B d9c8b6d6aebce7a45194dd6c654f4a2627714a5c1f7cb7a1cf80ed8c3fe861e3bb7857811128787ddd6c093b4370784b40cddb385cfbd30f6134d537fe949d2d SHA512 925d8957fd9008d041737a9e79ec8d7a4c5deba1976e980362d355a75348c1638d783d9d48234a5bc3b2dc3f2f09dcb281d0c80ae0f0c5bc32e176c3dfa05463 diff --git a/dev-python/alembic/alembic-1.4.3.ebuild b/dev-python/alembic/alembic-1.4.3.ebuild new file mode 100644 index 0000000000000..92f5a8189f909 --- /dev/null +++ b/dev-python/alembic/alembic-1.4.3.ebuild @@ -0,0 +1,45 @@ +# Copyright 1999-2020 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=7 + +PYTHON_COMPAT=( pypy3 python3_{6..9} ) +DISTUTILS_USE_SETUPTOOLS=rdepend + +inherit distutils-r1 + +DESCRIPTION="database migrations tool, written by the author of SQLAlchemy" +HOMEPAGE="https://github.com/sqlalchemy/alembic" +SRC_URI="mirror://pypi/${PN:0:1}/${PN}/${P}.tar.gz" + +LICENSE="MIT" +SLOT="0" +KEYWORDS="~amd64 ~arm64 ~x86" +IUSE="doc" + +RDEPEND=" + >=dev-python/sqlalchemy-1.1.0[${PYTHON_USEDEP}] + dev-python/mako[${PYTHON_USEDEP}] + >=dev-python/python-editor-0.3[${PYTHON_USEDEP}] + dev-python/python-dateutil[${PYTHON_USEDEP}] +" + +PATCHES=( + # https://github.com/sqlalchemy/alembic/commit/8690940976544f368dad31cfbc46d9e1426b2ce1 + "${FILESDIR}/${P}-pytest6.patch" +) + +distutils_enable_tests pytest + +python_prepare_all() { + # suite passes all if run from source. The residual fail & error are quite erroneous + rm tests/test_script_consumption.py || die + + distutils-r1_python_prepare_all +} + +python_install_all() { + use doc && local HTML_DOCS=( docs/. ) + + distutils-r1_python_install_all +} diff --git a/dev-python/alembic/files/alembic-1.4.3-pytest6.patch b/dev-python/alembic/files/alembic-1.4.3-pytest6.patch new file mode 100644 index 0000000000000..ecf21a7ca58ff --- /dev/null +++ b/dev-python/alembic/files/alembic-1.4.3-pytest6.patch @@ -0,0 +1,66 @@ +From 8690940976544f368dad31cfbc46d9e1426b2ce1 Mon Sep 17 00:00:00 2001 +From: Mike Bayer +Date: Sat, 26 Sep 2020 21:05:53 -0400 +Subject: [PATCH] Support pytest 6.x + +pytest has removed support for pytest.Class(..parent) +and we need to use from_parent. + +Also works around new issue for 6.1.0 + +References: https://github.com/pytest-dev/pytest/issues/7807 + +Change-Id: Ia5fed9b22e76c99f71489283acee207f996f52a4 +--- + alembic/__init__.py | 2 +- + alembic/testing/plugin/pytestplugin.py | 10 ++-------- + tox.ini | 4 ++-- + 3 files changed, 5 insertions(+), 11 deletions(-) + + sys.modules["alembic.migration"] = migration + sys.modules["alembic.environment"] = environment +diff --git a/alembic/testing/plugin/pytestplugin.py b/alembic/testing/plugin/pytestplugin.py +index 1c8be05..ba3d35b 100644 +--- a/alembic/testing/plugin/pytestplugin.py ++++ b/alembic/testing/plugin/pytestplugin.py +@@ -33,16 +33,10 @@ def pytest_configure(config): + def pytest_pycollect_makeitem(collector, name, obj): + + if inspect.isclass(obj) and plugin_base.want_class(name, obj): +- +- # in pytest 5.4.0 +- # return [ +- # pytest.Class.from_parent(collector, +- # name=parametrize_cls.__name__) +- # for parametrize_cls in _parametrize_cls(collector.module, obj) +- # ] ++ ctor = getattr(pytest.Class, "from_parent", pytest.Class) + + return [ +- pytest.Class(parametrize_cls.__name__, parent=collector) ++ ctor(name=parametrize_cls.__name__, parent=collector) + for parametrize_cls in _parametrize_cls(collector.module, obj) + ] + elif ( +diff --git a/tox.ini b/tox.ini +index ed233ee..f144754 100644 +--- a/tox.ini ++++ b/tox.ini +@@ -7,7 +7,7 @@ SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git} + [testenv] + cov_args=--cov=alembic --cov-report term --cov-report xml + +-deps=pytest!=3.9.1,!=3.9.2 ++deps=pytest>4.6 + pytest-xdist + mock + sqla11: {[tox]SQLA_REPO}@rel_1_1 +@@ -30,7 +30,7 @@ usedevelop= + # only use --dropfirst option if we're *not* using -n; + # if -n is used, we're working in brand new DBs anyway + setenv= +- BASECOMMAND=python -m pytest ++ BASECOMMAND=python -m pytest --rootdir {toxinidir} + WORKERS=-n4 + sqla079: WORKERS=--dropfirst + cov: COVERAGE={[testenv]cov_args}