1
0
mirror of https://github.com/samba-team/samba.git synced 2025-12-23 00:23:53 +03:00

python:tests: Reuse policies and silos created by setUp() across all tests

We now create the claims in setUp() only once, preserving them so as to
reuse them across all of the tests using this class. Then we finally
delete them all in tearDownClass().

addClassCleanup() could make this cleaner, but it’s available only in
Python 3.8 and above.

This change reduces the time taken by my machine to run
samba.tests.samba_tool.domain_auth_policy from two minutes to ten
seconds.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton
2023-08-17 13:29:49 +12:00
committed by Andrew Bartlett
parent f71893c1a3
commit 981c341389
2 changed files with 49 additions and 31 deletions

View File

@@ -458,7 +458,7 @@ class AuthSiloMemberCmdTestCase(BaseAuthCmdTest):
# Remove organisational unit.
self.samdb.delete(self.ou, ["tree_delete:1"])
# Remove members from silos before deleting them in super.
# Remove members from silos.
for silo, members in self.members.items():
for member in members:
self.remove_silo_member(silo, member)