Back to index

moin  1.9.0~rc2
Classes | Functions | Variables
MoinMoin._tests.ldap_testbase Namespace Reference

Classes

class  Slapd
class  LdapEnvironment

Functions

def check_environ

Variables

string SLAPD_EXECUTABLE = 'slapd'
 ldap = None

Function Documentation

Check the system environment whether we are able to run.
    Either return some failure reason if we can't or None if everything
    looks OK.

Definition at line 53 of file ldap_testbase.py.

00053 
00054 def check_environ():
00055     """ Check the system environment whether we are able to run.
00056         Either return some failure reason if we can't or None if everything
00057         looks OK.
00058     """
00059     if ldap is None:
00060         return "You need python-ldap installed to use ldap_testbase."
00061     slapd = False
00062     try:
00063         p = subprocess.Popen([SLAPD_EXECUTABLE, '-V'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
00064         pid = p.pid
00065         rc = p.wait()
00066         if pid and rc == 1:
00067             slapd = True  # it works
00068     except OSError, err:
00069         import errno
00070         if not (err.errno == errno.ENOENT or
00071                 (err.errno == 3 and os.name == 'nt')):
00072             raise
00073     if not slapd:
00074         return "Can't start %s (see SLAPD_EXECUTABLE)." % SLAPD_EXECUTABLE
00075     return None
00076 


Variable Documentation

Definition at line 50 of file ldap_testbase.py.

Definition at line 39 of file ldap_testbase.py.