[tracker/sam/diagrams: 5/9] functional-tests: Fix 'not a directory' error in writeback tests



commit 81e470fe79bd336b72ee6cf664e81c1539397d3e
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 ce6f2c7..a2337d8 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]