Merge "Fix cleanup of symlink fixtures"
This commit is contained in:
commit
fe15bf4934
@ -43,17 +43,10 @@ class SymlinkFixture(fixtures.Fixture):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
self._cleanup()
|
|
||||||
for (src, target) in self.links:
|
for (src, target) in self.links:
|
||||||
path = os.path.join(FIXTURE_DIR, 'links', src)
|
path = os.path.join(FIXTURE_DIR, 'links', src)
|
||||||
os.symlink(target, path)
|
os.symlink(target, path)
|
||||||
self.addCleanup(self._cleanup)
|
self.addCleanup(os.unlink, path)
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileList(testtools.TestCase):
|
class TestFileList(testtools.TestCase):
|
||||||
|
@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
self._cleanup()
|
|
||||||
for (src, target) in self.links:
|
for (src, target) in self.links:
|
||||||
path = os.path.join(FIXTURE_DIR, 'links', src)
|
path = os.path.join(FIXTURE_DIR, 'links', src)
|
||||||
os.symlink(target, path)
|
os.symlink(target, path)
|
||||||
self.addCleanup(self._cleanup)
|
self.addCleanup(os.unlink, path)
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileList(testtools.TestCase):
|
class TestFileList(testtools.TestCase):
|
||||||
|
@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
self._cleanup()
|
|
||||||
for (src, target) in self.links:
|
for (src, target) in self.links:
|
||||||
path = os.path.join(FIXTURE_DIR, 'links', src)
|
path = os.path.join(FIXTURE_DIR, 'links', src)
|
||||||
os.symlink(target, path)
|
os.symlink(target, path)
|
||||||
self.addCleanup(self._cleanup)
|
self.addCleanup(os.unlink, path)
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileList(testtools.TestCase):
|
class TestFileList(testtools.TestCase):
|
||||||
|
@ -44,17 +44,10 @@ class SymlinkFixture(fixtures.Fixture):
|
|||||||
]
|
]
|
||||||
|
|
||||||
def _setUp(self):
|
def _setUp(self):
|
||||||
self._cleanup()
|
|
||||||
for (src, target) in self.links:
|
for (src, target) in self.links:
|
||||||
path = os.path.join(FIXTURE_DIR, 'links', src)
|
path = os.path.join(FIXTURE_DIR, 'links', src)
|
||||||
os.symlink(target, path)
|
os.symlink(target, path)
|
||||||
self.addCleanup(self._cleanup)
|
self.addCleanup(os.unlink, path)
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
|
|
||||||
class TestFileList(testtools.TestCase):
|
class TestFileList(testtools.TestCase):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user