diff options
author | Michael Hudson <michael.hudson@linaro.org> | 2010-12-13 10:01:17 +1300 |
---|---|---|
committer | Michael Hudson <michael.hudson@linaro.org> | 2010-12-13 10:01:17 +1300 |
commit | 5e8b7e5c63b03c0d4b3e279db8d18bdb0ef7e251 (patch) | |
tree | 78637547a1b6e0d41933d4163508f7d68dfcd4a2 /hwpack | |
parent | 89a1b8c0e5ce1410d526ac5b73c8981979ad20da (diff) | |
parent | b83478bfa06e8f9bcdae53dd6aadbe589c577000 (diff) |
merge trunk
Diffstat (limited to 'hwpack')
-rw-r--r-- | hwpack/testing.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/hwpack/testing.py b/hwpack/testing.py index 798f823..a919a9a 100644 --- a/hwpack/testing.py +++ b/hwpack/testing.py @@ -161,6 +161,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): |