From: karim hamidou Date: Sat, 23 Nov 2013 18:53:06 +0000 (+0100) Subject: added utility test class X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=227795db020d0f64012c63fcd19eaaa723b35636;p=kite.git added utility test class --- diff --git a/src/back/tests/tmpdir.py b/src/back/tests/tmpdir.py new file mode 100644 index 0000000..09bbd02 --- /dev/null +++ b/src/back/tests/tmpdir.py @@ -0,0 +1,21 @@ +# base class for tests who need a temporary directory +import unittest +import shutil +import tempfile +import os + +class TestCaseWithTempDir(unittest.TestCase): + def setUp(self): + self.tmpdir = tempfile.mkdtemp() + + def tearDown(self): + shutil.rmtree(self.tmpdir) + +class TestCaseWithTempFile(unittest.TestCase): + def setUp(self): + self.tmpfd, self.tmpfile = tempfile.mkstemp() + + def tearDown(self): + os.remove(self.tmpfile) + +