summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2021-06-19 11:31:27 +0200
committerMichał Górny <mgorny@gentoo.org>2021-07-02 10:25:42 +0200
commit8762d06220293fe492f76c45b6f04940a70959f6 (patch)
tree7ceced07c42e7c9fae50af1671b338ee3b30a366 /dev-python/werkzeug
parentpython-utils-r1.eclass: Pass -Wdefault to epytest to avoid -Werror (diff)
downloadgentoo-8762d06220293fe492f76c45b6f04940a70959f6.tar.gz
gentoo-8762d06220293fe492f76c45b6f04940a70959f6.tar.bz2
gentoo-8762d06220293fe492f76c45b6f04940a70959f6.zip
dev-python/werkzeug: Fix tests with -Wdefault
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'dev-python/werkzeug')
-rw-r--r--dev-python/werkzeug/files/werkzeug-2.0.1-test-warning.patch75
-rw-r--r--dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild1
2 files changed, 76 insertions, 0 deletions
diff --git a/dev-python/werkzeug/files/werkzeug-2.0.1-test-warning.patch b/dev-python/werkzeug/files/werkzeug-2.0.1-test-warning.patch
new file mode 100644
index 000000000000..3bb14ab6ba42
--- /dev/null
+++ b/dev-python/werkzeug/files/werkzeug-2.0.1-test-warning.patch
@@ -0,0 +1,75 @@
+From 4201d0f6d1b337a0e69900a79042215896eede4a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org>
+Date: Sat, 19 Jun 2021 09:51:43 +0200
+Subject: [PATCH] Fix warning tests to work correctly without -Werror
+
+Use pytest.warns() instead of pytest.raises() to test for warnings,
+in order to make these tests work correctly without -Werror. This does
+not change the behavior with -Werror.
+
+While -Werror is useful for package maintainers / CI, it is problematic
+for testing on end user systems. For end users, it is important whether
+the particular version of package is going to work on their setup,
+not whether it does not use anything that's deprecated but still
+working.
+---
+ CHANGES.rst | 2 ++
+ tests/test_wrappers.py | 12 ++++++------
+ 2 files changed, 8 insertions(+), 6 deletions(-)
+
+diff --git a/CHANGES.rst b/CHANGES.rst
+index 8fa1e454..9a05145f 100644
+--- a/CHANGES.rst
++++ b/CHANGES.rst
+@@ -5,6 +5,8 @@ Version 2.1.0
+
+ Unreleased
+
++- Fix warning tests to work correctly without -Werror
++
+
+ Version 2.0.2
+ -------------
+diff --git a/tests/test_wrappers.py b/tests/test_wrappers.py
+index 3ac80003..fe8c01f3 100644
+--- a/tests/test_wrappers.py
++++ b/tests/test_wrappers.py
+@@ -1633,29 +1633,29 @@ def test_response_mixins_deprecated(cls):
+ class CheckResponse(cls, wrappers.Response):
+ pass
+
+- with pytest.raises(DeprecationWarning, match=cls.__name__):
++ with pytest.warns(DeprecationWarning, match=cls.__name__):
+ CheckResponse()
+
+
+ def test_check_base_deprecated():
+- with pytest.raises(DeprecationWarning, match=r"issubclass\(cls, Request\)"):
++ with pytest.warns(DeprecationWarning, match=r"issubclass\(cls, Request\)"):
+ assert issubclass(wrappers.Request, wrappers.BaseRequest)
+
+- with pytest.raises(DeprecationWarning, match=r"isinstance\(obj, Request\)"):
++ with pytest.warns(DeprecationWarning, match=r"isinstance\(obj, Request\)"):
+ assert isinstance(
+ wrappers.Request({"SERVER_NAME": "example.org", "SERVER_PORT": "80"}),
+ wrappers.BaseRequest,
+ )
+
+- with pytest.raises(DeprecationWarning, match=r"issubclass\(cls, Response\)"):
++ with pytest.warns(DeprecationWarning, match=r"issubclass\(cls, Response\)"):
+ assert issubclass(wrappers.Response, wrappers.BaseResponse)
+
+- with pytest.raises(DeprecationWarning, match=r"isinstance\(obj, Response\)"):
++ with pytest.warns(DeprecationWarning, match=r"isinstance\(obj, Response\)"):
+ assert isinstance(wrappers.Response(), wrappers.BaseResponse)
+
+
+ def test_response_freeze_no_etag_deprecated():
+- with pytest.raises(DeprecationWarning, match="no_etag"):
++ with pytest.warns(DeprecationWarning, match="no_etag"):
+ Response("Hello, World!").freeze(no_etag=True)
+
+
+--
+2.32.0
+
diff --git a/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
index a6c56f6d470f..2a62f10069ba 100644
--- a/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
+++ b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
@@ -37,6 +37,7 @@ distutils_enable_tests pytest
PATCHES=(
"${FILESDIR}"/${P}-py310.patch
+ "${FILESDIR}"/${P}-test-warning.patch
)
python_test() {