Skip to content

Commit 184a814

Browse files
committed
Skip test if slapd is not installed
Signed-off-by: tdruez <[email protected]>
1 parent 69bbc00 commit 184a814

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

.github/workflows/run-unit-tests.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,6 @@ jobs:
4242
with:
4343
python-version: "3.13"
4444

45-
# - name: Install python-ldap OS dependencies
46-
# run: |
47-
# sudo apt-get update
48-
# # https://github.com/python-ldap/python-ldap/blob/main/.github/workflows/ci.yml
49-
# sudo apt-get install -y libldap2-dev libsasl2-dev slapd ldap-utils enchant-2 apparmor-utils
50-
# # Disable AppArmor for slapd to allow slapdtest to create temp instances
51-
# sudo aa-disable /usr/sbin/slapd
52-
5345
- name: Install python-ldap OS dependencies
5446
run: |
5547
sudo apt-get update

dje/tests/test_ldap.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
"""
2222

2323
import logging
24+
import shutil
25+
import unittest
2426

2527
from django.apps import apps
2628
from django.conf import settings
@@ -96,6 +98,12 @@
9698
"""
9799

98100

101+
def slapd_available():
102+
"""Check if slapd is available in the system"""
103+
return shutil.which("slapd") is not None
104+
105+
106+
@unittest.skipUnless(slapd_available(), "slapd not installed")
99107
@override_settings(
100108
AUTHENTICATION_BACKENDS=("dje.ldap_backend.DejaCodeLDAPBackend",),
101109
AUTH_LDAP_DATASPACE="nexB",

0 commit comments

Comments
 (0)