From 676eb68eb45e24287c52381e8456d297acf55c51 Mon Sep 17 00:00:00 2001 From: jlaine Date: Mon, 31 May 2010 17:19:59 +0000 Subject: [PATCH] make tearDown more robust git-svn-id: https://svn.bolloretelecom.eu/opensource/django-ldapdb/trunk@897 e071eeec-0327-468d-9b6a-08194a12b294 --- examples/tests.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/tests.py b/examples/tests.py index c677c81..f98fbdf 100644 --- a/examples/tests.py +++ b/examples/tests.py @@ -40,9 +40,12 @@ class BaseTestCase(TestCase): def tearDown(self): cursor = connection._cursor() for base in [LdapGroup.base_dn, LdapUser.base_dn]: - results = cursor.connection.search_s(base, ldap.SCOPE_SUBTREE) - for dn, attrs in reversed(results): - cursor.connection.delete_s(dn) + try: + results = cursor.connection.search_s(base, ldap.SCOPE_SUBTREE) + for dn, attrs in reversed(results): + cursor.connection.delete_s(dn) + except ldap.NO_SUCH_OBJECT: + pass class GroupTestCase(BaseTestCase): def setUp(self): -- 2.30.2