diff --git a/roles/generate-zuul-manifest/library/test_generate_manifest.py b/roles/generate-zuul-manifest/library/test_generate_manifest.py index a239523da..69ce4a194 100644 --- a/roles/generate-zuul-manifest/library/test_generate_manifest.py +++ b/roles/generate-zuul-manifest/library/test_generate_manifest.py @@ -43,17 +43,10 @@ class SymlinkFixture(fixtures.Fixture): ] def _setUp(self): - self._cleanup() for (src, target) in self.links: path = os.path.join(FIXTURE_DIR, 'links', src) os.symlink(target, path) - self.addCleanup(self._cleanup) - - def _cleanup(self): - for (src, target) in self.links: - path = os.path.join(FIXTURE_DIR, 'links', src) - if os.path.exists(path): - os.unlink(path) + self.addCleanup(os.unlink, path) class TestFileList(testtools.TestCase): diff --git a/roles/test-upload-logs-swift/library/test_zuul_swift_upload.py b/roles/test-upload-logs-swift/library/test_zuul_swift_upload.py index 9b9053213..6577c31cc 100644 --- a/roles/test-upload-logs-swift/library/test_zuul_swift_upload.py +++ b/roles/test-upload-logs-swift/library/test_zuul_swift_upload.py @@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture): ] def _setUp(self): - self._cleanup() for (src, target) in self.links: path = os.path.join(FIXTURE_DIR, 'links', src) os.symlink(target, path) - self.addCleanup(self._cleanup) - - def _cleanup(self): - for (src, target) in self.links: - path = os.path.join(FIXTURE_DIR, 'links', src) - if os.path.exists(path): - os.unlink(path) + self.addCleanup(os.unlink, path) class TestFileList(testtools.TestCase): diff --git a/roles/upload-logs-gcs/library/test_zuul_google_storage_upload.py b/roles/upload-logs-gcs/library/test_zuul_google_storage_upload.py index 01fd71c7f..ed5c55627 100644 --- a/roles/upload-logs-gcs/library/test_zuul_google_storage_upload.py +++ b/roles/upload-logs-gcs/library/test_zuul_google_storage_upload.py @@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture): ] def _setUp(self): - self._cleanup() for (src, target) in self.links: path = os.path.join(FIXTURE_DIR, 'links', src) os.symlink(target, path) - self.addCleanup(self._cleanup) - - def _cleanup(self): - for (src, target) in self.links: - path = os.path.join(FIXTURE_DIR, 'links', src) - if os.path.exists(path): - os.unlink(path) + self.addCleanup(os.unlink, path) class TestFileList(testtools.TestCase): diff --git a/roles/upload-logs-swift/library/test_zuul_swift_upload.py b/roles/upload-logs-swift/library/test_zuul_swift_upload.py index 9b9053213..6577c31cc 100644 --- a/roles/upload-logs-swift/library/test_zuul_swift_upload.py +++ b/roles/upload-logs-swift/library/test_zuul_swift_upload.py @@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture): ] def _setUp(self): - self._cleanup() for (src, target) in self.links: path = os.path.join(FIXTURE_DIR, 'links', src) os.symlink(target, path) - self.addCleanup(self._cleanup) - - def _cleanup(self): - for (src, target) in self.links: - path = os.path.join(FIXTURE_DIR, 'links', src) - if os.path.exists(path): - os.unlink(path) + self.addCleanup(os.unlink, path) class TestFileList(testtools.TestCase):