Merge "Fix cleanup of symlink fixtures"

This commit is contained in:
Zuul 2020-02-25 16:46:09 +00:00 committed by Gerrit Code Review
commit fe15bf4934
4 changed files with 4 additions and 32 deletions

View File

@ -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):

View File

@ -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):

View File

@ -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):

View File

@ -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):