[tracker: 1/4] functional-tests: Fix 'not a directory' error in writeback tests



commit d6a0c2dc26f9b9d4496954864d95acf16844c896
Author: Sam Thursfield <sam afuera me uk>
Date:   Tue Dec 23 16:10:36 2014 +0000

    functional-tests: Fix 'not a directory' error in writeback tests
    
    This makes the following error less likely, and clearer when it does
    occur:
    
        (tracker-miner-fs:28886): Tracker-WARNING **: Could not open directory 
'file:///home/sam/tracker-tests/writeback': Not a directory

 .../functional-tests/common/utils/writebacktest.py |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
---
diff --git a/tests/functional-tests/common/utils/writebacktest.py 
b/tests/functional-tests/common/utils/writebacktest.py
index 801434a..63c3ef7 100644
--- a/tests/functional-tests/common/utils/writebacktest.py
+++ b/tests/functional-tests/common/utils/writebacktest.py
@@ -63,6 +63,12 @@ class CommonTrackerWritebackTest (ut.TestCase):
             datadir = os.path.join (cfg.DATADIR, "tracker-tests",
                                     "test-writeback-data")
 
+        if not os.path.exists(WRITEBACK_TMP_DIR):
+            os.makedirs(WRITEBACK_TMP_DIR)
+        else:
+            if not os.path.isdir(WRITEBACK_TMP_DIR):
+                raise Exception("%s exists already and is not a directory" % WRITEBACK_TMP_DIR)
+
         for testfile in [TEST_FILE_JPEG, TEST_FILE_PNG,TEST_FILE_TIFF]:
             origin = os.path.join (datadir, testfile)
             log ("Copying %s -> %s" % (origin, WRITEBACK_TMP_DIR))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]