Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-python/werkzeug/, dev-python/werkzeug/files/
Date: Fri, 02 Jul 2021 08:30:14
Message-Id: 1625214342.8762d06220293fe492f76c45b6f04940a70959f6.mgorny@gentoo
1 commit: 8762d06220293fe492f76c45b6f04940a70959f6
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Jun 19 09:31:27 2021 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Fri Jul 2 08:25:42 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=8762d062
7
8 dev-python/werkzeug: Fix tests with -Wdefault
9
10 Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
11
12 .../files/werkzeug-2.0.1-test-warning.patch | 75 ++++++++++++++++++++++
13 dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild | 1 +
14 2 files changed, 76 insertions(+)
15
16 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
17 new file mode 100644
18 index 00000000000..3bb14ab6ba4
19 --- /dev/null
20 +++ b/dev-python/werkzeug/files/werkzeug-2.0.1-test-warning.patch
21 @@ -0,0 +1,75 @@
22 +From 4201d0f6d1b337a0e69900a79042215896eede4a Mon Sep 17 00:00:00 2001
23 +From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@g.o>
24 +Date: Sat, 19 Jun 2021 09:51:43 +0200
25 +Subject: [PATCH] Fix warning tests to work correctly without -Werror
26 +
27 +Use pytest.warns() instead of pytest.raises() to test for warnings,
28 +in order to make these tests work correctly without -Werror. This does
29 +not change the behavior with -Werror.
30 +
31 +While -Werror is useful for package maintainers / CI, it is problematic
32 +for testing on end user systems. For end users, it is important whether
33 +the particular version of package is going to work on their setup,
34 +not whether it does not use anything that's deprecated but still
35 +working.
36 +---
37 + CHANGES.rst | 2 ++
38 + tests/test_wrappers.py | 12 ++++++------
39 + 2 files changed, 8 insertions(+), 6 deletions(-)
40 +
41 +diff --git a/CHANGES.rst b/CHANGES.rst
42 +index 8fa1e454..9a05145f 100644
43 +--- a/CHANGES.rst
44 ++++ b/CHANGES.rst
45 +@@ -5,6 +5,8 @@ Version 2.1.0
46 +
47 + Unreleased
48 +
49 ++- Fix warning tests to work correctly without -Werror
50 ++
51 +
52 + Version 2.0.2
53 + -------------
54 +diff --git a/tests/test_wrappers.py b/tests/test_wrappers.py
55 +index 3ac80003..fe8c01f3 100644
56 +--- a/tests/test_wrappers.py
57 ++++ b/tests/test_wrappers.py
58 +@@ -1633,29 +1633,29 @@ def test_response_mixins_deprecated(cls):
59 + class CheckResponse(cls, wrappers.Response):
60 + pass
61 +
62 +- with pytest.raises(DeprecationWarning, match=cls.__name__):
63 ++ with pytest.warns(DeprecationWarning, match=cls.__name__):
64 + CheckResponse()
65 +
66 +
67 + def test_check_base_deprecated():
68 +- with pytest.raises(DeprecationWarning, match=r"issubclass\(cls, Request\)"):
69 ++ with pytest.warns(DeprecationWarning, match=r"issubclass\(cls, Request\)"):
70 + assert issubclass(wrappers.Request, wrappers.BaseRequest)
71 +
72 +- with pytest.raises(DeprecationWarning, match=r"isinstance\(obj, Request\)"):
73 ++ with pytest.warns(DeprecationWarning, match=r"isinstance\(obj, Request\)"):
74 + assert isinstance(
75 + wrappers.Request({"SERVER_NAME": "example.org", "SERVER_PORT": "80"}),
76 + wrappers.BaseRequest,
77 + )
78 +
79 +- with pytest.raises(DeprecationWarning, match=r"issubclass\(cls, Response\)"):
80 ++ with pytest.warns(DeprecationWarning, match=r"issubclass\(cls, Response\)"):
81 + assert issubclass(wrappers.Response, wrappers.BaseResponse)
82 +
83 +- with pytest.raises(DeprecationWarning, match=r"isinstance\(obj, Response\)"):
84 ++ with pytest.warns(DeprecationWarning, match=r"isinstance\(obj, Response\)"):
85 + assert isinstance(wrappers.Response(), wrappers.BaseResponse)
86 +
87 +
88 + def test_response_freeze_no_etag_deprecated():
89 +- with pytest.raises(DeprecationWarning, match="no_etag"):
90 ++ with pytest.warns(DeprecationWarning, match="no_etag"):
91 + Response("Hello, World!").freeze(no_etag=True)
92 +
93 +
94 +--
95 +2.32.0
96 +
97
98 diff --git a/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
99 index a6c56f6d470..2a62f10069b 100644
100 --- a/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
101 +++ b/dev-python/werkzeug/werkzeug-2.0.1-r1.ebuild
102 @@ -37,6 +37,7 @@ distutils_enable_tests pytest
103
104 PATCHES=(
105 "${FILESDIR}"/${P}-py310.patch
106 + "${FILESDIR}"/${P}-test-warning.patch
107 )
108
109 python_test() {