From d69a36c25f039773e82650a5b2eb1cd57d359a8f Mon Sep 17 00:00:00 2001 From: James Valleroy Date: Tue, 5 Jan 2021 19:13:29 -0500 Subject: [PATCH] users: Avoid test error if ldapsearch is not available ldapsearch is provided by ldap-utils, which is not a build dependency. Test: Build package using `gbp buildpackage`. Signed-off-by: James Valleroy Reviewed-by: Veiko Aasa --- plinth/modules/users/tests/test_actions.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/plinth/modules/users/tests/test_actions.py b/plinth/modules/users/tests/test_actions.py index 44de66169..4fd2cdbf7 100644 --- a/plinth/modules/users/tests/test_actions.py +++ b/plinth/modules/users/tests/test_actions.py @@ -24,10 +24,13 @@ _cleanup_groups = None def _is_ldap_set_up(): """Return whether LDAP is set up.""" - return subprocess.call([ - 'ldapsearch', '-Y', 'EXTERNAL', '-H', 'ldapi:///', '-b', - 'ou=groups,dc=thisbox' - ]) == 0 + try: + return subprocess.call([ + 'ldapsearch', '-Y', 'EXTERNAL', '-H', 'ldapi:///', '-b', + 'ou=groups,dc=thisbox' + ]) == 0 + except FileNotFoundError: + return False pytestmark = [