Exemple #1
0
def test_06_params(instance_path):
    """Test referencing input parameters in other fields."""
    hello = Path(instance_path) / 'hello.tar'
    hello.touch()

    argv = ['tar', 'xf', 'hello.tar', 'goodbye.txt']
    factory = CommandLineToolFactory(
        argv,
        directory=instance_path,
        working_dir=instance_path,
    )

    assert factory.inputs[1].default == 'goodbye.txt'
    assert factory.inputs[1].type == 'string'
    assert factory.inputs[1].inputBinding.position == 2

    goodbye_id = factory.inputs[1].id

    # simulate run

    output = Path(instance_path) / 'goodbye.txt'
    output.touch()

    parameters = list(factory.guess_outputs([output]))

    assert parameters[0][0].type == 'File'
    assert parameters[0][0].outputBinding.glob == \
        '$(inputs.{0})'.format(goodbye_id)

    tool = factory.generate_tool()
    assert tool.to_argv() == argv
def test_04_output(client):
    """Test describtion of outputs from a command."""
    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']
    factory = CommandLineToolFactory(argv,
                                     directory=client.path,
                                     working_dir=client.path)

    # simulate run

    output = Path(client.path) / 'hello.txt'
    output.touch()

    parameters = list(factory.guess_outputs([output]))

    assert 'File' == parameters[0][0].type
    assert 'hello.txt' == parameters[0][0].outputBinding.glob

    tool = factory.generate_process_run(client=client,
                                        commit=client.repo.head.commit,
                                        path='dummy.yaml')

    tool = tool.association.plan
    assert argv == tool.to_argv()
Exemple #3
0
def test_04_output(instance_path):
    """Test describtion of outputs from a command."""
    hello = Path(instance_path) / 'hello.tar'
    hello.touch()

    argv = ['tar', 'xf', 'hello.tar']
    factory = CommandLineToolFactory(argv,
                                     directory=instance_path,
                                     working_dir=instance_path)

    # simulate run

    output = Path(instance_path) / 'hello.txt'
    output.touch()

    parameters = list(factory.guess_outputs([output]))

    assert parameters[0][0].type == 'File'
    assert parameters[0][0].outputBinding.glob == 'hello.txt'

    tool = factory.generate_tool()
    assert tool.to_argv() == argv
def test_06_params(client):
    """Test referencing input parameters in other fields."""
    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', 'goodbye.txt']
    factory = CommandLineToolFactory(
        argv,
        directory=client.path,
        working_dir=client.path,
    )

    assert 'goodbye.txt' == factory.inputs[1].default
    assert 'string' == factory.inputs[1].type
    assert 2 == factory.inputs[1].inputBinding.position

    goodbye_id = factory.inputs[1].id

    # simulate run

    output = Path(client.path) / 'goodbye.txt'
    output.touch()

    parameters = list(factory.guess_outputs([output]))

    assert 'File' == parameters[0][0].type
    assert '$(inputs.{0})'.format(goodbye_id) == \
           parameters[0][0].outputBinding.glob

    tool = factory.generate_process_run(client=client,
                                        commit=client.repo.head.commit,
                                        path='dummy.yaml')

    tool = tool.association.plan
    assert argv == tool.to_argv()
Exemple #5
0
def test_06_params(client):
    """Test referencing input parameters in other fields."""
    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", "goodbye.txt"]
    factory = CommandLineToolFactory(
        argv,
        directory=client.path,
        working_dir=client.path,
    )

    assert "goodbye.txt" == factory.inputs[1].default
    assert "string" == factory.inputs[1].type
    assert 2 == factory.inputs[1].inputBinding.position

    goodbye_id = factory.inputs[1].id

    # simulate run

    output = Path(client.path) / "goodbye.txt"
    output.touch()

    parameters = list(factory.guess_outputs([output]))

    assert "File" == parameters[0][0].type
    assert "$(inputs.{0})".format(
        goodbye_id) == parameters[0][0].outputBinding.glob

    tool = factory.generate_process_run(client=client,
                                        commit=client.repo.head.commit,
                                        path="dummy.yaml")

    tool = tool.association.plan
    assert argv == tool.to_argv()