[ARVADOS] updated: 441ef97e93a951b349356df96d8a6ef604c6cab7

Git user git at public.curoverse.com
Wed Jun 28 09:24:58 EDT 2017


Summary of changes:
 sdk/python/arvados/commands/put.py | 12 +++++-----
 sdk/python/tests/test_arv_put.py   | 49 ++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 6 deletions(-)

       via  441ef97e93a951b349356df96d8a6ef604c6cab7 (commit)
       via  3551a0395c7358e52e0a8f15cca6f149e026e646 (commit)
      from  0c3581ea0f492024a44475aa76fe5c728cbcb38c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 441ef97e93a951b349356df96d8a6ef604c6cab7
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Wed Jun 28 10:24:37 2017 -0300

    11789: Added tests.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at curoverse.com>

diff --git a/sdk/python/tests/test_arv_put.py b/sdk/python/tests/test_arv_put.py
index bfa39b8..8fbfd2f 100644
--- a/sdk/python/tests/test_arv_put.py
+++ b/sdk/python/tests/test_arv_put.py
@@ -672,6 +672,13 @@ class ArvadosPutTest(run_test_server.TestCaseWithServers,
                           self.call_main_with_args,
                           ['--project-uuid', self.Z_UUID, '--stream'])
 
+    def test_error_when_excluding_absolute_path(self):
+        tmpdir = self.make_tmpdir()
+        self.assertRaises(SystemExit,
+                          self.call_main_with_args,
+                          ['--exclude', '/some/absolute/path/*',
+                           tmpdir])
+
     def test_api_error_handling(self):
         coll_save_mock = mock.Mock(name='arv.collection.Collection().save_new()')
         coll_save_mock.side_effect = arvados.errors.ApiError(
@@ -914,6 +921,48 @@ class ArvPutIntegrationTest(run_test_server.TestCaseWithServers,
                                        '--project-uuid', self.PROJECT_UUID])
         self.assertEqual(link_name, collection['name'])
 
+    def test_exclude_filename_pattern(self):
+        tmpdir = self.make_tmpdir()
+        tmpsubdir = os.path.join(tmpdir, 'subdir')
+        os.mkdir(tmpsubdir)
+        for fname in ['file1', 'file2', 'file3']:
+            with open(os.path.join(tmpdir, "%s.txt" % fname), 'w') as f:
+                f.write("This is %s" % fname)
+            with open(os.path.join(tmpsubdir, "%s.txt" % fname), 'w') as f:
+                f.write("This is %s" % fname)
+        col = self.run_and_find_collection("", ['--no-progress',
+                                                '--exclude', '*2.txt',
+                                                '--exclude', 'file3.*',
+                                                 tmpdir])
+        self.assertNotEqual(None, col['uuid'])
+        c = arv_put.api_client.collections().get(uuid=col['uuid']).execute()
+        # None of the file2.txt & file3.txt should have been uploaded
+        self.assertRegex(c['manifest_text'], r'^.*:file1.txt')
+        self.assertNotRegex(c['manifest_text'], r'^.*:file2.txt')
+        self.assertNotRegex(c['manifest_text'], r'^.*:file3.txt')
+
+    def test_exclude_filepath_pattern(self):
+        tmpdir = self.make_tmpdir()
+        tmpsubdir = os.path.join(tmpdir, 'subdir')
+        os.mkdir(tmpsubdir)
+        for fname in ['file1', 'file2', 'file3']:
+            with open(os.path.join(tmpdir, "%s.txt" % fname), 'w') as f:
+                f.write("This is %s" % fname)
+            with open(os.path.join(tmpsubdir, "%s.txt" % fname), 'w') as f:
+                f.write("This is %s" % fname)
+        col = self.run_and_find_collection("", ['--no-progress',
+                                                '--exclude', 'subdir/*2.txt',
+                                                 tmpdir])
+        self.assertNotEqual(None, col['uuid'])
+        c = arv_put.api_client.collections().get(uuid=col['uuid']).execute()
+        # Only tmpdir/file2.txt should have been uploaded
+        self.assertRegex(c['manifest_text'], r'^.*:file1.txt')
+        self.assertRegex(c['manifest_text'],
+                         r'^\./%s.*:file2.txt' % os.path.basename(tmpdir))
+        self.assertNotRegex(c['manifest_text'],
+                            r'^\./%s/subdir.*:file2.txt' % os.path.basename(tmpdir))
+        self.assertRegex(c['manifest_text'], r'^.*:file3.txt')
+
 
 if __name__ == '__main__':
     unittest.main()

commit 3551a0395c7358e52e0a8f15cca6f149e026e646
Author: Lucas Di Pentima <lucas at curoverse.com>
Date:   Tue Jun 27 23:29:55 2017 -0300

    11789: Converting a filter() iterable to list, for python3 compatibility.
    
    Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas at curoverse.com>

diff --git a/sdk/python/arvados/commands/put.py b/sdk/python/arvados/commands/put.py
index 9fa68ec..a0f64e1 100644
--- a/sdk/python/arvados/commands/put.py
+++ b/sdk/python/arvados/commands/put.py
@@ -486,22 +486,22 @@ class ArvPutUploadJob(object):
                         root_relpath = ''
                     # Exclude files/dirs by full path matching pattern
                     if self.exclude_paths:
-                        dirs[:] = filter(
+                        dirs[:] = list(filter(
                             lambda d: not any(
                                 [pathname_match(os.path.join(root_relpath, d),
                                                 pat)
                                  for pat in self.exclude_paths]),
-                            dirs)
-                        files = filter(
+                            dirs))
+                        files = list(filter(
                             lambda f: not any(
                                 [pathname_match(os.path.join(root_relpath, f),
                                                 pat)
                                  for pat in self.exclude_paths]),
-                            files)
+                            files))
                     # Exclude files/dirs by name matching pattern
                     if self.exclude_names is not None:
-                        dirs[:] = filter(lambda d: not self.exclude_names.match(d), dirs)
-                        files = filter(lambda f: not self.exclude_names.match(f), files)
+                        dirs[:] = list(filter(lambda d: not self.exclude_names.match(d), dirs))
+                        files = list(filter(lambda f: not self.exclude_names.match(f), files))
                     # Make os.walk()'s dir traversing order deterministic
                     dirs.sort()
                     files.sort()

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list