summaryrefslogtreecommitdiffstats
path: root/tests/unit/test_pastedeploy.py
diff options
context:
space:
mode:
authorMonty Taylor <mordred@inaugust.com>2013-01-22 19:54:57 -0500
committerMonty Taylor <mordred@inaugust.com>2013-01-24 16:26:43 +1100
commit827547a0b3da411441bf691ddbc94867001a3311 (patch)
tree17fb6b54fa0e00f8fa41d447f865e1ceb25b004a /tests/unit/test_pastedeploy.py
parent1bc3ecf25d1b86dcb178d5f59b178bde94f5f667 (diff)
downloadoslo-827547a0b3da411441bf691ddbc94867001a3311.tar.gz
oslo-827547a0b3da411441bf691ddbc94867001a3311.tar.xz
oslo-827547a0b3da411441bf691ddbc94867001a3311.zip
Use testtools as test base class.
On the path to testr migration, we need to replace the unittest base classes with testtools. Replace tearDown with addCleanup, addCleanup is more resilient than tearDown. The fixtures library has excellent support for managing and cleaning tempfiles. Use it. Replace skip_ with testtools.skipTest Part of blueprint grizzly-testtools. Change-Id: I45e11bbb1ff9b31f3278d3b016737dcb7850cd98
Diffstat (limited to 'tests/unit/test_pastedeploy.py')
-rw-r--r--tests/unit/test_pastedeploy.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/unit/test_pastedeploy.py b/tests/unit/test_pastedeploy.py
index 9746fe5..817eb47 100644
--- a/tests/unit/test_pastedeploy.py
+++ b/tests/unit/test_pastedeploy.py
@@ -16,7 +16,9 @@
import os
import tempfile
-import unittest
+
+import fixtures
+import testtools
from openstack.common import pastedeploy
@@ -41,27 +43,20 @@ class Filter(object):
self.data = data
-class PasteTestCase(unittest.TestCase):
+class PasteTestCase(testtools.TestCase):
def setUp(self):
- self.tempfiles = []
-
- def tearDown(self):
- self.remove_tempfiles()
+ super(PasteTestCase, self).setUp()
+ self.useFixture(fixtures.NestedTempfile())
def create_tempfile(self, contents):
(fd, path) = tempfile.mkstemp()
- self.tempfiles.append(path)
try:
os.write(fd, contents)
finally:
os.close(fd)
return path
- def remove_tempfiles(self):
- for p in self.tempfiles:
- os.remove(p)
-
def test_app_factory(self):
data = 'test_app_factory'