It is a de-facto standard to use deselect=() and/or ignore=() arrays
to pass arguments to epytest.  Let's make the function take them
automatically without requiring unsafe hacks such as:

    epytest ${deselect[@]/#/--deselect }

Signed-off-by: Michał Górny <[email protected]>
---
 eclass/python-utils-r1.eclass | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/eclass/python-utils-r1.eclass b/eclass/python-utils-r1.eclass
index b104b6694ac3..04b82d4f7a78 100644
--- a/eclass/python-utils-r1.eclass
+++ b/eclass/python-utils-r1.eclass
@@ -1250,6 +1250,10 @@ build_sphinx() {
 # Run pytest, passing the standard set of pytest options, followed
 # by user-specified options.
 #
+# If 'deselect' array is present in the calling scope, all its elements
+# are added as --deselect arguments to pytest.  If 'ignore' array
+# is present, its elements are added as --ignore arguments.
+#
 # This command dies on failure and respects nonfatal.
 epytest() {
        debug-print-function ${FUNCNAME} "${@}"
@@ -1268,6 +1272,13 @@ epytest() {
                # for end users, as it tends to fail on new warnings from deps
                -Wdefault
        )
+       local x
+       for x in "${deselect[@]}"; do
+               args+=( --deselect "${x}" )
+       done
+       for x in "${ignore[@]}"; do
+               args+=( --ignore "${x}" )
+       done
        set -- "${EPYTHON}" -m pytest "${args[@]}" "${@}"
 
        echo "${@}" >&2
-- 
2.32.0


Reply via email to