1 |
Force pytest color output on or off based on the presence and value |
2 |
of NOCOLOR envvar. This fixes inconsistent use of colors that largely |
3 |
depended on upstream pytest settings. |
4 |
|
5 |
Signed-off-by: Michał Górny <mgorny@g.o> |
6 |
--- |
7 |
eclass/python-utils-r1.eclass | 12 ++++++++++++ |
8 |
1 file changed, 12 insertions(+) |
9 |
|
10 |
diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
11 |
index 22e00c56815d..225f781cc31f 100644 |
12 |
--- a/eclass/python-utils-r1.eclass |
13 |
+++ b/eclass/python-utils-r1.eclass |
14 |
@@ -1291,6 +1291,16 @@ epytest() { |
15 |
|
16 |
_python_check_EPYTHON |
17 |
|
18 |
+ local color |
19 |
+ case ${NOCOLOR} in |
20 |
+ true|yes) |
21 |
+ color=no |
22 |
+ ;; |
23 |
+ *) |
24 |
+ color=yes |
25 |
+ ;; |
26 |
+ esac |
27 |
+ |
28 |
local args=( |
29 |
# verbose progress reporting and tracebacks |
30 |
-vv |
31 |
@@ -1302,6 +1312,8 @@ epytest() { |
32 |
# override filterwarnings=error, we do not really want -Werror |
33 |
# for end users, as it tends to fail on new warnings from deps |
34 |
-Wdefault |
35 |
+ # override color output |
36 |
+ "--color=${color}" |
37 |
) |
38 |
local x |
39 |
for x in "${EPYTEST_DESELECT[@]}"; do |
40 |
-- |
41 |
2.34.1 |