summaryrefslogtreecommitdiff
path: root/lib/ldb/tests/python/api.py
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2017-09-21 14:15:32 +1200
committerAndrew Bartlett <abartlet@samba.org>2017-09-22 21:20:25 +0200
commit644b3ffb14252f2a2dfe282b5d748b6ea86325e1 (patch)
treef164f6c64e9666e36f5bf94d1772678a272ea194 /lib/ldb/tests/python/api.py
parenta0b46ecdd2481699ce91c2636d4eac9067f8f69e (diff)
downloadsamba-644b3ffb14252f2a2dfe282b5d748b6ea86325e1.tar.gz
samba-644b3ffb14252f2a2dfe282b5d748b6ea86325e1.tar.bz2
samba-644b3ffb14252f2a2dfe282b5d748b6ea86325e1.zip
ldb: Ensure we do not run out of File descriptors in autobuild
The python TestCase API will keep a reference to the test object until the end of the tests, long after we need the actual LDB or the fd. Signed-off-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'lib/ldb/tests/python/api.py')
-rwxr-xr-xlib/ldb/tests/python/api.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/ldb/tests/python/api.py b/lib/ldb/tests/python/api.py
index ba9476a0e68..14bbdcb1718 100755
--- a/lib/ldb/tests/python/api.py
+++ b/lib/ldb/tests/python/api.py
@@ -55,6 +55,9 @@ class SimpleLdb(TestCase):
def tearDown(self):
shutil.rmtree(self.testdir)
super(SimpleLdb, self).tearDown()
+ # Ensure the LDB is closed now, so we close the FD
+ del(self.ldb)
+
def test_connect(self):
ldb.Ldb(self.filename)
@@ -610,6 +613,10 @@ class SearchTests(TestCase):
shutil.rmtree(self.testdir)
super(SearchTests, self).tearDown()
+ # Ensure the LDB is closed now, so we close the FD
+ del(self.l)
+
+
def setUp(self):
super(SearchTests, self).setUp()
self.testdir = tempdir()
@@ -992,6 +999,9 @@ class AddModifyTests(TestCase):
shutil.rmtree(self.testdir)
super(AddModifyTests, self).tearDown()
+ # Ensure the LDB is closed now, so we close the FD
+ del(self.l)
+
def setUp(self):
super(AddModifyTests, self).setUp()
self.testdir = tempdir()
@@ -1243,6 +1253,10 @@ class DnTests(TestCase):
super(DnTests, self).setUp()
self.ldb = ldb.Ldb()
+ def tearDown(self):
+ super(DnTests, self).tearDown()
+ del(self.ldb)
+
def test_set_dn_invalid(self):
x = ldb.Message()
def assign():
@@ -1863,6 +1877,8 @@ class LdbResultTests(TestCase):
def tearDown(self):
shutil.rmtree(self.testdir)
super(LdbResultTests, self).tearDown()
+ # Ensure the LDB is closed now, so we close the FD
+ del(self.l)
def test_return_type(self):
res = self.l.search()