Convert some try/finally to addCleanup

This commit is contained in:
Ned Batchelder
2015-03-22 07:26:21 -04:00
parent cb0624bfa1
commit e6e5a8d812
3 changed files with 22 additions and 36 deletions

View File

@@ -331,11 +331,7 @@ class EmailOptInListTest(ModuleStoreTestCase):
# Create a temporary directory for the output
# Delete it when we're finished
temp_dir_path = tempfile.mkdtemp()
def _cleanup(): # pylint: disable=missing-docstring
shutil.rmtree(temp_dir_path)
self.addCleanup(_cleanup)
self.addCleanup(shutil.rmtree, temp_dir_path)
# Sanitize the arguments
if other_names is None: