def test_03_input(instance_path): """Check the essential input parameters.""" whale = Path(instance_path) / 'whale.txt' whale.touch() argv = [ 'echo', '-f', '-i42', '--example-string', 'hello', '--file=whale.txt', ] tool = CommandLineToolFactory(argv, directory=instance_path, working_dir=instance_path).generate_tool() assert tool.arguments[0].to_argv() == ['-f'] assert tool.inputs[0].default == 42 assert tool.inputs[0].type == 'int' assert tool.inputs[0].inputBinding.prefix == '-i' assert tool.inputs[0].inputBinding.separate is False assert tool.inputs[1].default == 'hello' assert tool.inputs[1].type == 'string' assert tool.inputs[1].inputBinding.prefix == '--example-string' assert tool.inputs[1].inputBinding.separate is True assert tool.inputs[2].default.path.samefile(whale) assert tool.inputs[2].type == 'File' assert tool.inputs[2].inputBinding.prefix == '--file=' assert tool.inputs[2].inputBinding.separate is False assert tool.to_argv() == argv
def test_09_array_inputs(instance_path): """Test specification of input parameters in arrays.""" argv = [ 'echo', '-A', 'one', 'two', 'three', '-B=four', '-B=five', '-B=six', '-C=seven,eight,nine', ] tool = CommandLineToolFactory(argv, directory=instance_path, working_dir=instance_path).generate_tool() # TODO add grouping for -A and -B assert tool.inputs[-1].type == 'string[]' assert tool.inputs[-1].default == ['seven', 'eight', 'nine'] assert tool.inputs[-1].inputBinding.prefix == '-C=' assert tool.inputs[-1].inputBinding.itemSeparator == ',' assert tool.inputs[-1].inputBinding.separate is False assert tool.to_argv() == argv
def test_short_base_command_detection(): """Test base command detection without arguments.""" tool = CommandLineToolFactory(('echo', 'A')).generate_tool() assert tool.cwlVersion == 'v1.0' assert tool.__class__.__name__ == 'CommandLineTool' assert tool.inputs[0].default == 'A' assert tool.to_argv() == ['echo', 'A']
def test_short_base_command_detection(client): """Test base command detection without arguments.""" tool = CommandLineToolFactory( ('echo', 'A')).generate_process_run(client=client, commit=client.repo.head.commit, path='dummy.yaml') tool = tool.association.plan assert 'A' == tool.arguments[0].value assert ['echo', 'A'] == tool.to_argv()
def test_base_command_detection(instance_path): """Test base command detection.""" hello = Path(instance_path) / 'hello.tar' hello.touch() argv = ['tar', 'xf', 'hello.tar'] tool = CommandLineToolFactory(argv, directory=instance_path, working_dir=instance_path).generate_tool() assert tool.baseCommand == ['tar', 'xf'] assert tool.inputs[0].default.path.samefile(hello) assert tool.inputs[0].type == 'File' assert tool.inputs[0].inputBinding.prefix is None assert tool.inputs[0].inputBinding.separate is True assert tool.to_argv() == argv
def test_base_command_detection(client): """Test base command detection.""" hello = Path(client.path) / 'hello.tar' hello.touch() client.repo.index.add([str(hello)]) client.repo.index.commit('add hello.tar') argv = ['tar', 'xf', 'hello.tar'] tool = CommandLineToolFactory( argv, directory=client.path, working_dir=client.path).generate_process_run( client=client, commit=client.repo.head.commit, path='dummy.yaml') tool = tool.association.plan assert 'tar xf' == tool.command assert tool.inputs[0].consumes.path == 'hello.tar' assert isinstance(tool.inputs[0].consumes, Entity) assert not isinstance(tool.inputs[0].consumes, Collection) assert tool.inputs[0].prefix is None assert argv == tool.to_argv()
def test_03_input(client): """Check the essential input parameters.""" whale = Path(client.path) / 'whale.txt' whale.touch() client.repo.index.add([str(whale)]) client.repo.index.commit('add whale.txt') argv = [ 'echo', '-f', '-i42', '--example-string', 'hello', '--file=whale.txt', ] tool = CommandLineToolFactory( argv, directory=client.path, working_dir=client.path).generate_process_run( client=client, commit=client.repo.head.commit, path='dummy.yaml') tool = tool.association.plan assert ['-f'] == tool.arguments[0].to_argv() assert 42 == tool.arguments[1].value assert '-i' == tool.arguments[1].prefix assert 'hello' == tool.arguments[2].value assert '--example-string ' == tool.arguments[2].prefix assert tool.inputs[0].consumes.path == 'whale.txt' assert isinstance(tool.inputs[0].consumes, Entity) assert not isinstance(tool.inputs[0].consumes, Collection) assert '--file=' == tool.inputs[0].prefix assert argv == tool.to_argv()
def test_03_input(client): """Check the essential input parameters.""" whale = Path(client.path) / "whale.txt" whale.touch() client.repo.index.add([str(whale)]) client.repo.index.commit("add whale.txt") argv = [ "echo", "-f", "-i42", "--example-string", "hello", "--file=whale.txt", ] tool = CommandLineToolFactory( argv, directory=client.path, working_dir=client.path).generate_process_run( client=client, commit=client.repo.head.commit, path="dummy.yaml") tool = tool.association.plan assert ["-f"] == tool.arguments[0].to_argv() assert 42 == tool.arguments[1].value assert "-i" == tool.arguments[1].prefix assert "hello" == tool.arguments[2].value assert "--example-string " == tool.arguments[2].prefix assert tool.inputs[0].consumes.path == "whale.txt" assert isinstance(tool.inputs[0].consumes, Entity) assert not isinstance(tool.inputs[0].consumes, Collection) assert "--file=" == tool.inputs[0].prefix assert argv == tool.to_argv()
def test_09_array_inputs(client): """Test specification of input parameters in arrays.""" argv = [ 'echo', '-A', 'one', 'two', 'three', '-B=four', '-B=five', '-B=six', '-C=seven,eight,nine', ] tool = CommandLineToolFactory( argv, directory=client.path, working_dir=client.path).generate_process_run( client=client, commit=client.repo.head.commit, path='dummy.yaml') tool = tool.association.plan assert 'seven,eight,nine' == tool.arguments[-1].value assert '-C=' == tool.arguments[-1].prefix assert argv == tool.to_argv()
def test_09_array_inputs(client): """Test specification of input parameters in arrays.""" argv = [ "echo", "-A", "one", "two", "three", "-B=four", "-B=five", "-B=six", "-C=seven,eight,nine", ] tool = CommandLineToolFactory( argv, directory=client.path, working_dir=client.path).generate_process_run( client=client, commit=client.repo.head.commit, path="dummy.yaml") tool = tool.association.plan assert "seven,eight,nine" == tool.arguments[-1].value assert "-C=" == tool.arguments[-1].prefix assert argv == tool.to_argv()
def test_09_array_inputs(instance_path): """Test specification of input parameters in arrays.""" argv = [ 'echo', '-A', 'one', 'two', 'three', '-B=four', '-B=five', '-B=six', '-C=seven,eight,nine', ] tool = CommandLineToolFactory(argv, directory=instance_path, working_dir=instance_path).generate_tool() assert 'string[]' == tool.inputs[-1].type assert ['seven', 'eight', 'nine'] == tool.inputs[-1].default assert '-C=' == tool.inputs[-1].inputBinding.prefix assert ',' == tool.inputs[-1].inputBinding.itemSeparator assert tool.inputs[-1].inputBinding.separate is False assert argv == tool.to_argv()