[PATCH] selftest: close connections after tests in samba4.ldap.acl.python

Andrew Bartlett abartlet at samba.org
Mon Jan 8 09:08:21 UTC 2018

On Mon, 2018-01-08 at 09:47 +0100, Andreas Schneider wrote:
> On Monday, 8 January 2018 02:13:18 CET Jamie McClymont via samba-technical 
> wrote:
> > (now with missing signoff!)
> Thanks for those patches. But normally you have setup and teardown functions 
> which should be responsible for allocating and cleaning up memory, creating 
> and deleting users etc. Those setup functions can then be shared in different 
> tests.
> A lot of python tests don't seem to follow basic unit testing rules. So I 
> think just correctly working with setup and teardown would fix a lot more bugs 
> we have in those tests.
> Just my 2 cents.

Jamie can write more in the morning, but to clarify without waiting a
day, here are the docs for addCleanup (which we implement even on
python 2.6):


That is, even if this wasn't a complex test using a tricky balance of
class inheritance on top of the password_lockout test addCleanup would
still be a good way to incrementally clean up things created during

We should use it more, in my view, it would save a lot of the 'delete
the user in case the last run faulted' code. 


Andrew Bartlett

Andrew Bartlett                       http://samba.org/~abartlet/
Authentication Developer, Samba Team  http://samba.org
Samba Developer, Catalyst IT          http://catalyst.net.nz/services/samba

More information about the samba-technical mailing list