If the python script throws an unexpected exception, the HAVE_PYTEST
variable remains undefined. If at the same time dependencies are not
actually present, pytest tests will fail instead of being skipped.
Define the variable to 'no' on unexpected failures to skip the tests
when dependencies cannot be verified.
The issue can be reproduced on systems with python 3.12+ in case the
deprecated 'pkg_resources' module is not available.
Fixes: 445dceb88461 ("python: Introduce unit tests.")
Signed-off-by: Ilya Maximets <[email protected]>
---
tests/atlocal.in | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/tests/atlocal.in b/tests/atlocal.in
index f321bae55..466fd4ed4 100644
--- a/tests/atlocal.in
+++ b/tests/atlocal.in
@@ -242,5 +242,6 @@ with
pathlib.Path(os.path.join(os.getenv("REQUIREMENT_PATH"))).open() as reqs:
case $? in
0) HAVE_PYTEST=yes ;;
2) HAVE_PYTEST=no ;;
- *) echo "$0: unexpected error probing Python unit test requirements" >&2 ;;
+ *) HAVE_PYTEST=no
+ echo "$0: unexpected error probing Python unit test requirements" >&2 ;;
esac
--
2.45.0
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev