projects
/
arvados.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
11543: Upload tool dependencies into single collection. Add test for collection...
[arvados.git]
/
sdk
/
cwl
/
tests
/
test_pathmapper.py
diff --git
a/sdk/cwl/tests/test_pathmapper.py
b/sdk/cwl/tests/test_pathmapper.py
index 3b6af04b293e8f48e320fa6508716d3c6d27faf6..3e7918a24a68fcb538dbf9307fea063303af9d02 100644
(file)
--- a/
sdk/cwl/tests/test_pathmapper.py
+++ b/
sdk/cwl/tests/test_pathmapper.py
@@
-16,9
+16,10
@@
from .mock_discovery import get_rootDesc
from arvados_cwl.pathmapper import ArvPathMapper
from arvados_cwl.pathmapper import ArvPathMapper
-def upload_mock(files, api, dry_run=False, num_retries=0, project=None, fnPattern="$(file %s/%s)", name=None):
+def upload_mock(files, api, dry_run=False, num_retries=0, project=None, fnPattern="$(file %s/%s)", name=None
, collection=None
):
pdh = "99999999999999999999999999999991+99"
for c in files:
pdh = "99999999999999999999999999999991+99"
for c in files:
+ c.keepref = "%s/%s" % (pdh, os.path.basename(c.fn))
c.fn = fnPattern % (pdh, os.path.basename(c.fn))
class TestPathmap(unittest.TestCase):
c.fn = fnPattern % (pdh, os.path.basename(c.fn))
class TestPathmap(unittest.TestCase):
@@
-36,23
+37,29
@@
class TestPathmap(unittest.TestCase):
"location": "keep:99999999999999999999999999999991+99/hw.py"
}], "", "/test/%s", "/test/%s/%s")
"location": "keep:99999999999999999999999999999991+99/hw.py"
}], "", "/test/%s", "/test/%s/%s")
- self.assertEqual({'keep:99999999999999999999999999999991+99/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File')},
+ self.assertEqual({'keep:99999999999999999999999999999991+99/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File'
, staged=True
)},
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
- def test_upload(self, upl):
+ @mock.patch("arvados.commands.run.statfile")
+ def test_upload(self, statfile, upl):
"""Test pathmapper uploading files."""
arvrunner = arvados_cwl.ArvCwlRunner(self.api)
"""Test pathmapper uploading files."""
arvrunner = arvados_cwl.ArvCwlRunner(self.api)
+ def statfile_mock(prefix, fn, fnPattern="$(file %s/%s)", dirPattern="$(dir %s/%s/)"):
+ st = arvados.commands.run.UploadFile("", "tests/hw.py")
+ return st
+
upl.side_effect = upload_mock
upl.side_effect = upload_mock
+ statfile.side_effect = statfile_mock
p = ArvPathMapper(arvrunner, [{
"class": "File",
p = ArvPathMapper(arvrunner, [{
"class": "File",
- "location": "tests/hw.py"
+ "location": "
file:
tests/hw.py"
}], "", "/test/%s", "/test/%s/%s")
}], "", "/test/%s", "/test/%s/%s")
- self.assertEqual({'
tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File'
)},
+ self.assertEqual({'
file:tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File', staged=True
)},
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
@@
-60,16
+67,16
@@
class TestPathmap(unittest.TestCase):
"""Test pathmapper handling previously uploaded files."""
arvrunner = arvados_cwl.ArvCwlRunner(self.api)
"""Test pathmapper handling previously uploaded files."""
arvrunner = arvados_cwl.ArvCwlRunner(self.api)
- arvrunner.add_uploaded('
tests/hw.py', MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='', type='File'
))
+ arvrunner.add_uploaded('
file:tests/hw.py', MapperEnt(resolved='keep:99999999999999999999999999999992+99/hw.py', target='', type='File', staged=True
))
upl.side_effect = upload_mock
p = ArvPathMapper(arvrunner, [{
"class": "File",
upl.side_effect = upload_mock
p = ArvPathMapper(arvrunner, [{
"class": "File",
- "location": "tests/hw.py"
+ "location": "
file:
tests/hw.py"
}], "", "/test/%s", "/test/%s/%s")
}], "", "/test/%s", "/test/%s/%s")
- self.assertEqual({'
tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File'
)},
+ self.assertEqual({'
file:tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999992+99/hw.py', target='/test/99999999999999999999999999999992+99/hw.py', type='File', staged=True
)},
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
p._pathmap)
@mock.patch("arvados.commands.run.uploadfiles")
@@
-89,8
+96,8
@@
class TestPathmap(unittest.TestCase):
p = ArvPathMapper(arvrunner, [{
"class": "File",
p = ArvPathMapper(arvrunner, [{
"class": "File",
- "location": "tests/hw.py"
+ "location": "
file:
tests/hw.py"
}], "", "/test/%s", "/test/%s/%s")
}], "", "/test/%s", "/test/%s/%s")
- self.assertEqual({'
tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File'
)},
+ self.assertEqual({'
file:tests/hw.py': MapperEnt(resolved='keep:99999999999999999999999999999991+99/hw.py', target='/test/99999999999999999999999999999991+99/hw.py', type='File', staged=True
)},
p._pathmap)
p._pathmap)