summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2020-04-04 13:39:52 -0400
committerMike Gilbert <floppym@gentoo.org>2020-04-04 13:39:52 -0400
commit511119474703cbc8f2ff0dd8fe07e1029483c4fa (patch)
tree35314d81b321deaeb10d7d51a84f024fd233bcfc /dev-python/sqlalchemy
parentwww-client/chromium: stable channel bump to 80.0.3987.163 (diff)
downloadgentoo-511119474703cbc8f2ff0dd8fe07e1029483c4fa.tar.gz
gentoo-511119474703cbc8f2ff0dd8fe07e1029483c4fa.tar.bz2
gentoo-511119474703cbc8f2ff0dd8fe07e1029483c4fa.zip
dev-python/sqlalchemy: backport test fix for newer pytest
Package-Manager: Portage-2.3.96_p4, Repoman-2.3.22_p1 Signed-off-by: Mike Gilbert <floppym@gentoo.org>
Diffstat (limited to 'dev-python/sqlalchemy')
-rw-r--r--dev-python/sqlalchemy/files/sqlalchemy-pytest-deprecation.patch67
-rw-r--r--dev-python/sqlalchemy/sqlalchemy-1.3.11.ebuild12
2 files changed, 76 insertions, 3 deletions
diff --git a/dev-python/sqlalchemy/files/sqlalchemy-pytest-deprecation.patch b/dev-python/sqlalchemy/files/sqlalchemy-pytest-deprecation.patch
new file mode 100644
index 000000000000..ee09a7312e6a
--- /dev/null
+++ b/dev-python/sqlalchemy/files/sqlalchemy-pytest-deprecation.patch
@@ -0,0 +1,67 @@
+From 993e6449e3f5f3532f6f5426b824718435ce6c6d Mon Sep 17 00:00:00 2001
+From: Mike Bayer <mike_mp@zzzcomputing.com>
+Date: Thu, 12 Mar 2020 19:44:37 -0400
+Subject: [PATCH] Dont raise on pytest deprecation warnings
+
+py.test 5.4.0 emits deprecation warnings for pytest.Class.
+make sure we don't raise for these, and log the code that will
+be used for 5.4.0 when we bump requirements.
+
+Fixes: #5201
+Change-Id: I83e0402c4a6b2365a63b58d052c6989df3a37328
+---
+ lib/sqlalchemy/testing/plugin/pytestplugin.py | 13 +++++++++++++
+ lib/sqlalchemy/testing/warnings.py | 9 +++++++++
+ 3 files changed, 29 insertions(+)
+
+diff --git a/lib/sqlalchemy/testing/plugin/pytestplugin.py b/lib/sqlalchemy/testing/plugin/pytestplugin.py
+index c39f9f32e..f2e7d706f 100644
+--- a/lib/sqlalchemy/testing/plugin/pytestplugin.py
++++ b/lib/sqlalchemy/testing/plugin/pytestplugin.py
+@@ -160,6 +160,11 @@ def pytest_collection_modifyitems(session, config, items):
+ if sub_cls is not test_class.cls:
+ per_cls_dict = rebuilt_items[test_class.cls]
+
++ # in pytest 5.4.0
++ # for inst in pytest.Class.from_parent(
++ # test_class.parent.parent, name=sub_cls.__name__
++ # ).collect():
++
+ for inst in pytest.Class(
+ sub_cls.__name__, parent=test_class.parent.parent
+ ).collect():
+@@ -188,6 +193,14 @@ def pytest_collection_modifyitems(session, config, items):
+ 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)
++ # ]
++
+ return [
+ pytest.Class(parametrize_cls.__name__, parent=collector)
+ for parametrize_cls in _parametrize_cls(collector.module, obj)
+diff --git a/lib/sqlalchemy/testing/warnings.py b/lib/sqlalchemy/testing/warnings.py
+index cc11e556c..6b42c98cb 100644
+--- a/lib/sqlalchemy/testing/warnings.py
++++ b/lib/sqlalchemy/testing/warnings.py
+@@ -34,6 +34,15 @@ def setup_filters():
+ # ignore 2.0 warnings unless we are explicitly testing for them
+ warnings.filterwarnings("ignore", category=sa_exc.RemovedIn20Warning)
+
++ try:
++ import pytest
++ except ImportError:
++ pass
++ else:
++ warnings.filterwarnings(
++ "once", category=pytest.PytestDeprecationWarning
++ )
++
+
+ def assert_warnings(fn, warning_msgs, regex=False):
+ """Assert that each of the given warnings are emitted by fn.
diff --git a/dev-python/sqlalchemy/sqlalchemy-1.3.11.ebuild b/dev-python/sqlalchemy/sqlalchemy-1.3.11.ebuild
index f9bbd2c2e55a..63f36af545cc 100644
--- a/dev-python/sqlalchemy/sqlalchemy-1.3.11.ebuild
+++ b/dev-python/sqlalchemy/sqlalchemy-1.3.11.ebuild
@@ -22,15 +22,21 @@ IUSE="doc examples +sqlite test"
REQUIRED_USE="test? ( sqlite )"
-DEPEND="
- dev-python/setuptools[${PYTHON_USEDEP}]
- test? ( dev-python/mock[${PYTHON_USEDEP}] )"
+BDEPEND="
+ test? (
+ dev-python/mock[${PYTHON_USEDEP}]
+ dev-python/pytest-xdist[${PYTHON_USEDEP}]
+ )
+"
S="${WORKDIR}/${MY_P}"
distutils_enable_tests pytest
python_prepare_all() {
+ local PATCHES=(
+ "${FILESDIR}"/sqlalchemy-pytest-deprecation.patch
+ )
# Disable tests hardcoding function call counts specific to Python versions.
rm -r test/aaa_profiling || die
distutils-r1_python_prepare_all