11579: Check if paths exist, raise meaningful exception if not.
[arvados.git] / sdk / python / tests / test_arv_put.py
index 547cfc296b5a12bcfcbd8ef65c53a65a0e3f30aa..774e199ee1a8b703a3bb7559309c9f806cb8df9e 100644 (file)
@@ -17,6 +17,7 @@ import yaml
 import threading
 import hashlib
 import random
+import uuid
 
 from cStringIO import StringIO
 
@@ -302,6 +303,12 @@ class ArvPutUploadJobTest(run_test_server.TestCaseWithServers,
         self.assertNotIn('linkeddir2', cwriter.manifest_text())
         cwriter.destroy_cache()
 
+    def test_passing_nonexistant_path_raise_exception(self):
+        uuid_str = str(uuid.uuid4())
+        cwriter = arv_put.ArvPutUploadJob(["/this/path/does/not/exist/{}".format(uuid_str)])
+        with self.assertRaises(arv_put.PathDoesNotExistError):
+            cwriter.start(save_collection=False)
+
     def test_writer_works_without_cache(self):
         cwriter = arv_put.ArvPutUploadJob(['/dev/null'], resume=False)
         cwriter.start(save_collection=False)