1 |
On Wed, 2021-08-11 at 09:49 +0200, Michał Górny wrote: |
2 |
> It is a de-facto standard to use deselect=() and/or ignore=() arrays |
3 |
> to pass arguments to epytest. Let's make the function take them |
4 |
> automatically without requiring unsafe hacks such as: |
5 |
> |
6 |
> epytest ${deselect[@]/#/--deselect } |
7 |
> |
8 |
> Signed-off-by: Michał Górny <mgorny@g.o> |
9 |
> --- |
10 |
> eclass/python-utils-r1.eclass | 11 +++++++++++ |
11 |
> 1 file changed, 11 insertions(+) |
12 |
> |
13 |
> diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass |
14 |
> index b104b6694ac3..04b82d4f7a78 100644 |
15 |
> --- a/eclass/python-utils-r1.eclass |
16 |
> +++ b/eclass/python-utils-r1.eclass |
17 |
> @@ -1250,6 +1250,10 @@ build_sphinx() { |
18 |
> # Run pytest, passing the standard set of pytest options, followed |
19 |
> # by user-specified options. |
20 |
> # |
21 |
> +# If 'deselect' array is present in the calling scope, all its elements |
22 |
> +# are added as --deselect arguments to pytest. If 'ignore' array |
23 |
> +# is present, its elements are added as --ignore arguments. |
24 |
> +# |
25 |
> # This command dies on failure and respects nonfatal. |
26 |
> epytest() { |
27 |
> debug-print-function ${FUNCNAME} "${@}" |
28 |
> @@ -1268,6 +1272,13 @@ epytest() { |
29 |
> # for end users, as it tends to fail on new warnings from deps |
30 |
> -Wdefault |
31 |
> ) |
32 |
> + local x |
33 |
> + for x in "${deselect[@]}"; do |
34 |
> + args+=( --deselect "${x}" ) |
35 |
> + done |
36 |
> + for x in "${ignore[@]}"; do |
37 |
> + args+=( --ignore "${x}" ) |
38 |
> + done |
39 |
> set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}" |
40 |
> |
41 |
> echo "${@}" >&2 |
42 |
|
43 |
Arthur Zamarin did some grepping and found that there are ebuilds that |
44 |
are actually broken by this change. For example, in one ebuild some |
45 |
mgorny did: |
46 |
|
47 |
deselect=( --ignore ... ) |
48 |
|
49 |
I suppose we have two main options right now: |
50 |
|
51 |
1. Use more unique names for the new variables. Possibly make them |
52 |
uppercase and supported without redefining python_test(), e.g.: |
53 |
|
54 |
distutils_enable_tests pytest |
55 |
|
56 |
EPYTEST_DESELECT=( |
57 |
tests/some_broken_stuff.py::test_fnord |
58 |
) |
59 |
|
60 |
2. Pre-fix the ebuilds and go as-is. I kinda dislike this because it |
61 |
assumes custom repos could get hit by this, and requires us to find all |
62 |
potentially broken occurences. |
63 |
|
64 |
-- |
65 |
Best regards, |
66 |
Michał Górny |