[ARVADOS] updated: 1.1.0-14-g0bb435a
Git user
git at public.curoverse.com
Tue Oct 10 14:05:05 EDT 2017
Summary of changes:
sdk/cwl/arvados_cwl/fsaccess.py | 12 ++++++------
sdk/cwl/tests/12418-glob-empty-collection.cwl | 20 ++++++++++++++++++++
sdk/cwl/tests/arvados-tests.yml | 6 ++++++
sdk/python/tests/test_collections.py | 4 ++++
4 files changed, 36 insertions(+), 6 deletions(-)
create mode 100644 sdk/cwl/tests/12418-glob-empty-collection.cwl
via 0bb435a47e427b12fa2351141a22a1ba1e28a49d (commit)
via 29defca7cc4c36c110a5a5da60bbf4fca7528af1 (commit)
via c621fc52c25af82c90d435598134d1db7ba8e346 (commit)
from 455006efb88b2dbf7b489831d06afb850ac4e9aa (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 0bb435a47e427b12fa2351141a22a1ba1e28a49d
Merge: 455006e 29defca
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Oct 10 14:04:33 2017 -0400
Merge branch '12418-glob-empty-collection' closes #12418
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
commit 29defca7cc4c36c110a5a5da60bbf4fca7528af1
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Oct 10 14:03:55 2017 -0400
12418: Add regression test for glob output on empty collection.
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/sdk/cwl/tests/12418-glob-empty-collection.cwl b/sdk/cwl/tests/12418-glob-empty-collection.cwl
new file mode 100644
index 0000000..6c9e7f7
--- /dev/null
+++ b/sdk/cwl/tests/12418-glob-empty-collection.cwl
@@ -0,0 +1,20 @@
+{
+ "cwlVersion": "v1.0",
+ "arguments": [
+ "true"
+ ],
+ "class": "CommandLineTool",
+ "inputs": [],
+ "outputs": [
+ {
+ "id": "out",
+ "outputBinding": {
+ "glob": "*.txt"
+ },
+ "type": [
+ "null",
+ "File"
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/sdk/cwl/tests/arvados-tests.yml b/sdk/cwl/tests/arvados-tests.yml
index 2f1429e..a0de236 100644
--- a/sdk/cwl/tests/arvados-tests.yml
+++ b/sdk/cwl/tests/arvados-tests.yml
@@ -111,3 +111,9 @@
}
tool: 12213-keepref-wf.cwl
doc: "Test manipulating keep references with expression tools"
+
+- job: null
+ output:
+ out: null
+ tool: 12418-glob-empty-collection.cwl
+ doc: "Test glob output on empty collection"
commit c621fc52c25af82c90d435598134d1db7ba8e346
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date: Tue Oct 10 11:19:47 2017 -0400
12418: Explicitly check if collection is not None
The empty collection evaluates to False, so it is necessary to explicitly check
for "not None".
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz at veritasgenetics.com>
diff --git a/sdk/cwl/arvados_cwl/fsaccess.py b/sdk/cwl/arvados_cwl/fsaccess.py
index 08e203b..5bdd8dd 100644
--- a/sdk/cwl/arvados_cwl/fsaccess.py
+++ b/sdk/cwl/arvados_cwl/fsaccess.py
@@ -81,14 +81,14 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
def glob(self, pattern):
collection, rest = self.get_collection(pattern)
- if collection and not rest:
+ if collection is not None and not rest:
return [pattern]
patternsegments = rest.split("/")
return self._match(collection, patternsegments, "keep:" + collection.manifest_locator())
def open(self, fn, mode):
collection, rest = self.get_collection(fn)
- if collection:
+ if collection is not None:
return collection.open(rest, mode)
else:
return super(CollectionFsAccess, self).open(self._abs(fn), mode)
@@ -105,7 +105,7 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
def isfile(self, fn): # type: (unicode) -> bool
collection, rest = self.get_collection(fn)
- if collection:
+ if collection is not None:
if rest:
return isinstance(collection.find(rest), arvados.arvfile.ArvadosFile)
else:
@@ -115,7 +115,7 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
def isdir(self, fn): # type: (unicode) -> bool
collection, rest = self.get_collection(fn)
- if collection:
+ if collection is not None:
if rest:
return isinstance(collection.find(rest), arvados.collection.RichCollectionBase)
else:
@@ -125,7 +125,7 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
def listdir(self, fn): # type: (unicode) -> List[unicode]
collection, rest = self.get_collection(fn)
- if collection:
+ if collection is not None:
if rest:
dir = collection.find(rest)
else:
@@ -147,7 +147,7 @@ class CollectionFsAccess(cwltool.stdfsaccess.StdFsAccess):
if path.startswith("$(task.tmpdir)") or path.startswith("$(task.outdir)"):
return path
collection, rest = self.get_collection(path)
- if collection:
+ if collection is not None:
return path
else:
return os.path.realpath(path)
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index e8c6dd1..5f40bb2 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -97,6 +97,8 @@ class ArvadosCollectionsTest(run_test_server.TestCaseWithServers,
self.assertEqual(stream0.readfrom(2**26, 0),
b'',
'reading zero bytes should have returned empty string')
+ self.assertEqual(3, len(cr))
+ self.assertTrue(cr)
def _test_subset(self, collection, expected):
cr = arvados.CollectionReader(collection, self.api_client)
@@ -632,6 +634,8 @@ class CollectionReaderTestCase(unittest.TestCase, CollectionTestMixin):
reader = arvados.CollectionReader('d41d8cd98f00b204e9800998ecf8427e+0',
api_client=client)
self.assertEqual('', reader.manifest_text())
+ self.assertEqual(0, len(reader))
+ self.assertFalse(reader)
def test_api_response(self):
client = self.api_client_mock()
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list