Browse Source

[1704] Move test directory creation to setUp() / tearDown()

Mukund Sivaraman 13 years ago
parent
commit
e72bc121a7
1 changed files with 5 additions and 3 deletions
  1. 5 3
      src/bin/bind10/tests/bind10_test.py.in

+ 5 - 3
src/bin/bind10/tests/bind10_test.py.in

@@ -1464,10 +1464,14 @@ class SocketSrvTest(unittest.TestCase):
         self.assertTrue(sock.closed)
 
 class TestFunctions(unittest.TestCase):
-    def test_remove_lock_files(self):
+    def setUp(self):
         if not os.path.isdir(os.environ["LOCKFILE_TESTPATH"]):
             os.mkdir(os.environ["LOCKFILE_TESTPATH"])
 
+    def tearDown(self):
+        os.rmdir(os.environ["LOCKFILE_TESTPATH"])
+
+    def test_remove_lock_files(self):
         if "B10_FROM_BUILD" in os.environ:
             oldenv = os.environ["B10_FROM_BUILD"]
         else:
@@ -1493,8 +1497,6 @@ class TestFunctions(unittest.TestCase):
         # second call should not assert anyway
         bind10_src.remove_lock_files()
 
-        os.rmdir(os.environ["LOCKFILE_TESTPATH"])
-
         if oldenv is not None:
             os.environ["B10_FROM_BUILD"] = oldenv
         else: