commit: 8762d06220293fe492f76c45b6f04940a70959f6 Author: Michał Górny <mgorny <AT> gentoo <DOT> org> AuthorDate: Sat Jun 19 09:31:27 2021 +0000 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> CommitDate: Fri Jul 2 08:25:42 2021 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8762d062
dev-python/werkzeug: Fix tests with -Wdefault Signed-off-by: Michał Górny <mgorny <AT> gentoo.org> .../files/werkzeug-2.0.1-test-warning.patch | 75 ++++++++++++++++++++++ dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild | 1 + 2 files changed, 76 insertions(+) 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 00000000000..3bb14ab6ba4 --- /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?= <[email protected]> +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 a6c56f6d470..2a62f10069b 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() {
