Ejemplo n.º 1
0
def test_parse_failing_yaml():
    parsed = parse_yaml(config_file, create_defaults)
    assert parsed['git_user'] == "tgsmith61591"

    # show it fails since the project_name is not specified
    with pytest.raises(ValueError):
        validate_args(SimulatedNamespace(**parsed))
Ejemplo n.º 2
0
def test_store_true_value():
    parsed = parse_yaml(config_file, create_defaults)

    # Show that the stored value of "circle" is True (the bool)
    assert parsed['circle'] is True
    assert parsed['travis'] is False
Ejemplo n.º 3
0
def test_parse_non_existent():
    with pytest.raises(OSError):
        parse_yaml("non-existent", create_defaults)
Ejemplo n.º 4
0
def test_parse_passing_yaml():
    parsed = parse_yaml(config_file, create_defaults)
    assert parsed['project_name'] == 'test_package'

    # show it will pass
    validate_args(SimulatedNamespace(**parsed))
Ejemplo n.º 5
0
    c_parser.set_defaults(**create_defaults)

    # Parse and validate
    parsed_args, unknown_args = parser.parse_known_args()
    # TODO: someday do this better?
    # https://stackoverflow.com/questions/4575747/get-selected-subcommand-with-argparse
    method = sys.argv[1]
    if unknown_args:
        raise ValueError(
            "Unknown arguments for method='{method}': {unknown}".format(
                method=method, unknown=str(unknown_args)))

    # If we need to parse the yaml, do so now
    do_parse_yaml = method == "yaml"
    if do_parse_yaml:
        parsed_args = parse_yaml(parsed_args.config_file, create_defaults)

    # Now validate the args and create as normal
    args = validate_args(parsed_args)

    # This is the path where we'll be creating the directory
    pth = args['path']

    # Handle the project level files first
    try:
        make_package(header=header,
                     bear_location=bear_location,
                     bear_version=bear_version,
                     **args)
    except Exception:
        # First, remove the directory