aboutsummaryrefslogtreecommitdiff
path: root/hwpack
diff options
context:
space:
mode:
authorGuilherme Salgado <salgado@canonical.com>2010-12-08 14:49:44 -0200
committerGuilherme Salgado <salgado@canonical.com>2010-12-08 14:49:44 -0200
commit353921eb1fea138c7bab7936312f8ebe82cd57e5 (patch)
tree3257e16b80492e7c46910605b134f27120af63d9 /hwpack
parentd28dec041f75c3a42870511119e4c75599faaa5b (diff)
Port create_partitions to python
Diffstat (limited to 'hwpack')
-rw-r--r--hwpack/testing.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/hwpack/testing.py b/hwpack/testing.py
index 69f1feb..67398fe 100644
--- a/hwpack/testing.py
+++ b/hwpack/testing.py
@@ -159,6 +159,15 @@ class TestCaseWithFixtures(TestCase):
fixture.setUp()
return fixture
+ def createTempFileAsFixture(self, prefix='tmp'):
+ """Create a temp file and make sure it is removed on tearDown.
+
+ :return: The filename of the file created.
+ """
+ _, filename = tempfile.mkstemp(prefix=prefix)
+ self.addCleanup(os.unlink, filename)
+ return filename
+
class ConfigFileFixture(object):