Make IpcDaemonTestCase use a finally block to unlock PORTAGE_BUILDDIR. v2.2_rc82
authorZac Medico <zmedico@gentoo.org>
Tue, 14 Sep 2010 23:40:13 +0000 (16:40 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 14 Sep 2010 23:40:13 +0000 (16:40 -0700)
pym/portage/tests/ebuild/test_ipc_daemon.py

index 4c9a614f85e5cef92cea8b77eb26b9643ff963c3..b5b4796e121b4e95517f23214adda7076dde5e5d 100644 (file)
@@ -23,6 +23,7 @@ class IpcDaemonTestCase(TestCase):
 
        def testIpcDaemon(self):
                tmpdir = tempfile.mkdtemp()
+               build_dir = None
                try:
                        env = {}
 
@@ -117,6 +118,7 @@ class IpcDaemonTestCase(TestCase):
                                self.assertEqual(daemon.isAlive(), False)
                                self.assertEqual(proc.returncode == os.EX_OK, False)
 
-                       build_dir.unlock()
                finally:
+                       if build_dir is not None:
+                               build_dir.unlock()
                        shutil.rmtree(tmpdir)