X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/810fc3e7aab72aa5ae951141955b56f6d4e47cfd..3fa6aa4043286ad61e5f29c136d3cc2942e8750d:/sdk/cwl/tests/test_make_output.py diff --git a/sdk/cwl/tests/test_make_output.py b/sdk/cwl/tests/test_make_output.py index 9002bb1dfc..dd1da0b524 100644 --- a/sdk/cwl/tests/test_make_output.py +++ b/sdk/cwl/tests/test_make_output.py @@ -23,6 +23,13 @@ class TestMakeOutput(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 + @mock.patch("arvados.collection.Collection") @mock.patch("arvados.collection.CollectionReader") def test_make_output_collection(self, reader, col): @@ -43,7 +50,7 @@ class TestMakeOutput(unittest.TestCase): final.open.return_value = openmock openmock.__enter__.return_value = cwlout - _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "tag0,tag1,tag2", { + _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "tag0,tag1,tag2", {}, { "foo": { "class": "File", "location": "keep:99999999999999999999999999999991+99/foo.txt", @@ -60,7 +67,7 @@ class TestMakeOutput(unittest.TestCase): final.copy.assert_has_calls([mock.call('bar.txt', 'baz.txt', overwrite=False, source_collection=readermock)]) final.copy.assert_has_calls([mock.call('foo.txt', 'foo.txt', overwrite=False, source_collection=readermock)]) - final.save_new.assert_has_calls([mock.call(ensure_unique_name=True, name='Test output', owner_uuid='zzzzz-j7d0g-zzzzzzzzzzzzzzz', storage_classes=['foo'])]) + final.save_new.assert_has_calls([mock.call(ensure_unique_name=True, name='Test output', owner_uuid='zzzzz-j7d0g-zzzzzzzzzzzzzzz', properties={}, storage_classes=['foo'])]) self.assertEqual("""{ "bar": { "basename": "baz.txt", @@ -95,35 +102,35 @@ class TestMakeOutput(unittest.TestCase): reader.return_value = readermock # This output describes a single file listed in 2 different directories - _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "", { 'out': [ + _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "", {}, { 'out': [ { - 'basename': 'testdir1', + 'basename': 'testdir1', 'listing': [ - { - 'basename': 'test.txt', - 'nameroot': 'test', - 'nameext': '.txt', - 'location': 'keep:99999999999999999999999999999991+99/test.txt', - 'class': 'File', + { + 'basename': 'test.txt', + 'nameroot': 'test', + 'nameext': '.txt', + 'location': 'keep:99999999999999999999999999999991+99/test.txt', + 'class': 'File', 'size': 16 } - ], + ], 'location': '_:99999999999999999999999999999992+99', 'class': 'Directory' - }, + }, { - 'basename': 'testdir2', + 'basename': 'testdir2', 'listing': [ { - 'basename': 'test.txt', - 'nameroot': 'test', - 'nameext': '.txt', - 'location': 'keep:99999999999999999999999999999991+99/test.txt', - 'class': - 'File', + 'basename': 'test.txt', + 'nameroot': 'test', + 'nameext': '.txt', + 'location': 'keep:99999999999999999999999999999991+99/test.txt', + 'class': + 'File', 'size': 16 } - ], + ], 'location': '_:99999999999999999999999999999993+99', 'class': 'Directory' }]}) @@ -145,30 +152,30 @@ class TestMakeOutput(unittest.TestCase): reader.return_value = readermock # This output describes two literals with the same basename - _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "", [ - { - 'lit': + _, runner.final_output_collection = runner.make_output_collection("Test output", ["foo"], "", {}, [ + { + 'lit': { - 'basename': 'a_file', - 'nameext': '', - 'nameroot': 'a_file', - 'location': '_:f168fc0c-4291-40aa-a04e-366d57390560', - 'class': 'File', + 'basename': 'a_file', + 'nameext': '', + 'nameroot': 'a_file', + 'location': '_:f168fc0c-4291-40aa-a04e-366d57390560', + 'class': 'File', 'contents': 'Hello file literal.' } }, { - 'lit': + 'lit': { - 'basename': 'a_file', - 'nameext': '', - 'nameroot': 'a_file', - 'location': '_:1728da8f-c64e-4a3e-b2e2-1ee356be7bc8', - 'class': 'File', + 'basename': 'a_file', + 'nameext': '', + 'nameroot': 'a_file', + 'location': '_:1728da8f-c64e-4a3e-b2e2-1ee356be7bc8', + 'class': 'File', 'contents': 'Hello file literal.' } }]) # Check that the file name conflict is resolved and open is called for both final.open.assert_any_call("a_file", "wb") - final.open.assert_any_call("a_file_2", "wb") \ No newline at end of file + final.open.assert_any_call("a_file_2", "wb")