X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/51c1daf863f3e1920f758f73b4e5d70ff2c706d6..f11933fe893204fc0378d83b25167eb14ba4a265:/sdk/cwl/tests/test_pathmapper.py diff --git a/sdk/cwl/tests/test_pathmapper.py b/sdk/cwl/tests/test_pathmapper.py index b78e89012a..1a13fc7079 100644 --- a/sdk/cwl/tests/test_pathmapper.py +++ b/sdk/cwl/tests/test_pathmapper.py @@ -3,13 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 import functools -import mock import sys import unittest import json import logging import os +from unittest import mock + import arvados import arvados.keep import arvados.collection @@ -32,6 +33,13 @@ class TestPathmap(unittest.TestCase): self.api = mock.MagicMock() self.api._rootDesc = get_rootDesc() + def tearDown(self): + root_logger = logging.getLogger('') + + # Remove existing RuntimeStatusLoggingHandlers if they exist + handlers = [h for h in root_logger.handlers if not isinstance(h, arvados_cwl.executor.RuntimeStatusLoggingHandler)] + root_logger.handlers = handlers + def test_keepref(self): """Test direct keep references.""" @@ -231,3 +239,16 @@ class TestPathmap(unittest.TestCase): p._pathmap["keep:99999999999999999999999999999991+99/hw.py"] = True p._pathmap["_:123"] = True self.assertTrue(p.needs_new_collection(a)) + + def test_is_in_collection(self): + arvrunner = arvados_cwl.executor.ArvCwlExecutor(self.api) + self.maxDiff = 1000000 + + cwd = os.getcwd() + p = ArvPathMapper(arvrunner, [{ + "class": "File", + "location": "file://"+cwd+"/tests/fake-keep-mount/fake_collection_dir/subdir/banana.txt" + }], "", "/test/%s", "/test/%s/%s") + + self.assertEqual({"file://"+cwd+"/tests/fake-keep-mount/fake_collection_dir/subdir/banana.txt": MapperEnt(resolved='keep:99999999999999999999999999999991+99/subdir/banana.txt', target='/test/99999999999999999999999999999991+99/subdir/banana.txt', type='File', staged=True)}, + p._pathmap)