diff --git a/SAS/TMSS/test/ldap_test_service.py b/SAS/TMSS/test/ldap_test_service.py index b760be53c8aee496a5f57ca9fae9bf37b496d33c..11dd386437c3840a794e35cea90c4945e858c846 100644 --- a/SAS/TMSS/test/ldap_test_service.py +++ b/SAS/TMSS/test/ldap_test_service.py @@ -2,14 +2,17 @@ import os import logging logger = logging.getLogger(__name__) +logging_already_configured = len(logging.root.handlers)>0 + from ldap_test import LdapServer -# the 3rd party ldap_test module erroneously does a logging.basicConfig upon module import... -# logging.basicConfig should only happen in 'main'-like functions. -# so, undo the basicConfig by removing the root handlers. -# See: https://docs.python.org/3/library/logging.html#logging.basicConfig -for h in logging.root.handlers: - logging.root.removeHandler(h) +if not logging_already_configured: + # the 3rd party ldap_test module erroneously does a logging.basicConfig upon module import... + # logging.basicConfig should only happen in 'main'-like functions. + # so, undo the basicConfig by removing the root handlers. + # See: https://docs.python.org/3/library/logging.html#logging.basicConfig + for h in logging.root.handlers: + logging.root.removeHandler(h) from optparse import OptionParser