Esempio n. 1
0
def test_arg_parse():
    parser = arg_parser()

    # defaults
    args = parser.parse_args([])
    assert not args.with_reference_data
    assert not args.history_per_test_case
    assert args.page_size == 0
    assert args.page_number == 0
    assert args.parallel_tests == 1

    # skip flags
    args = parser.parse_args(
        ["--skip-with-reference-data", "--history-per-test-case"])
    assert not args.with_reference_data
    assert args.history_per_test_case

    # enable flags
    args = parser.parse_args(["--with-reference-data", "--history-per-suite"])
    assert args.with_reference_data
    assert not args.history_per_test_case

    # pagination
    args = parser.parse_args(
        ["--page-size", "5", "--page-number", "40", "--parallel-tests", "3"])
    assert args.page_size == 5
    assert args.page_number == 40
    assert args.parallel_tests == 3
    assert args.test_data is None

    args = parser.parse_args(["--test-data", "/foo/bar", "--test-data", "cow"])
    assert len(args.test_data) == 2
    assert args.test_data[0] == "/foo/bar"
    assert args.test_data[1] == "cow"

    args = parser.parse_args(["--skip-previously-successful"])
    assert args.skip == "successful"

    args = parser.parse_args(["--skip-previously-executed"])
    assert args.skip == "executed"
Esempio n. 2
0
def main(argv=None):
    """Entry point function for galaxy-workflow-tool-tests."""
    if argv is None:
        argv = sys.argv[1:]

    parser = arg_parser()
    parser.add_argument('workflow_id',
                        metavar='WORKFLOW_ID',
                        help='workflow id to scan for tools')
    args = parser.parse_args(argv)
    gi = galaxy.GalaxyInstance(url=args.galaxy_url,
                               key=args.admin_key or args.key)
    workflows = gi.workflows
    workflow_dict = workflows.export_workflow_dict(args.workflow_id)
    tool_ids = []
    for step_dict in workflow_dict.get("steps").values():
        if not step_dict.get("type") == "tool":
            continue
        tool_ids.append(step_dict["tool_id"])

    def tool_not_in_workflow(test_reference):
        return test_reference.tool_id not in tool_ids

    run_tests(args, test_filters=[tool_not_in_workflow])