[web/test] don't delete uicache directory
authorJulien Cristau <julien.cristau@logilab.fr>
Wed, 11 Jun 2014 15:33:09 +0200
changeset 10318 09273cb083e7
parent 10317 b81adb5e32f9
child 10319 0d3ede4865a8
[web/test] don't delete uicache directory Other tests use it, so the rmtree was a bit too much. Set CACHEDIR to a temporary subdirectory, and only delete that.
web/test/unittest_propertysheet.py
--- a/web/test/unittest_propertysheet.py	Fri Feb 20 16:17:51 2015 +0100
+++ b/web/test/unittest_propertysheet.py	Wed Jun 11 15:33:09 2014 +0200
@@ -1,13 +1,21 @@
 import os
 from os.path import join, dirname
 from shutil import rmtree
+import errno
+import tempfile
 
 from logilab.common.testlib import TestCase, unittest_main
 
 from cubicweb.web.propertysheet import PropertySheet, lazystr
 
 DATADIR = join(dirname(__file__), 'data')
-CACHEDIR = join(DATADIR, 'uicache')
+
+try:
+    os.makedirs(join(DATADIR, 'uicache'))
+except OSError as err:
+    if err.errno != errno.EEXIST:
+        raise
+CACHEDIR = tempfile.mkdtemp(dir=join(DATADIR, 'uicache'))
 
 class PropertySheetTC(TestCase):