Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH] python-utils-r1.eclass: Pass -Wdefault to epytest to avoid -Werror
Date: Sat, 19 Jun 2021 09:32:44
Message-Id: 20210619093232.165028-1-mgorny@gentoo.org
1 Make pytest pass -Wdefault in order to override upstream default warning
2 options that commonly include -Werror. This has often caused tests to
3 start failing due to new deprecation warnings introduced
4 in dependencies, or block new implementations due to harmless
5 deprecation warnings.
6
7 A side effect of this is that we are overriding all warning options used
8 by upstream. This could e.g. cause more warnings to be reported (when
9 upstream ignores some of them). This might also break badly written
10 tests (e.g. when they rely on exceptions to catch warnings).
11
12 Signed-off-by: Michał Górny <mgorny@g.o>
13 ---
14 eclass/python-utils-r1.eclass | 3 +++
15 1 file changed, 3 insertions(+)
16
17 diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
18 index 3dbf221eac5d..2766db4d9da6 100644
19 --- a/eclass/python-utils-r1.eclass
20 +++ b/eclass/python-utils-r1.eclass
21 @@ -1284,6 +1284,9 @@ epytest() {
22 -ra
23 # print local variables in tracebacks, useful for debugging
24 -l
25 + # override filterwarnings=error, we do not really want -Werror
26 + # for end users, as it tends to fail on new warnings from deps
27 + -Wdefault
28 )
29 set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
30
31 --
32 2.32.0