You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bloodhound.apache.org by ju...@apache.org on 2013/02/01 11:16:19 UTC

svn commit: r1441374 - /incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py

Author: jure
Date: Fri Feb  1 10:16:18 2013
New Revision: 1441374

URL: http://svn.apache.org/viewvc?rev=1441374&view=rev
Log:
Cleanup environment path if setUp fails


Modified:
    incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py

Modified: incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py
URL: http://svn.apache.org/viewvc/incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py?rev=1441374&r1=1441373&r2=1441374&view=diff
==============================================================================
--- incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py (original)
+++ incubator/bloodhound/branches/bep_0003_multiproduct/trac/trac/tests/env.py Fri Feb  1 10:16:18 2013
@@ -13,6 +13,7 @@ class EnvironmentTestCase(unittest.TestC
 
     def setUp(self):
         env_path = os.path.join(tempfile.gettempdir(), 'trac-tempenv')
+        self.addCleanup(self.cleanupEnvPath, env_path)
         self.env = Environment(env_path, create=True)
 
     def tearDown(self):
@@ -21,6 +22,10 @@ class EnvironmentTestCase(unittest.TestC
         self.env.shutdown() # really closes the db connections
         shutil.rmtree(self.env.path)
 
+    def cleanupEnvPath(self, path):
+        if os.path.exists(path):
+            shutil.rmtree(path)
+
     def test_get_version(self):
         """Testing env.get_version"""
         assert self.env.get_version() == db_default.db_version