Exemple #1
0
def test_stage_load_on_invalid_data(tmp_dir, dvc, file):
    data = {"is_this_a_valid_dvcfile": False}
    dump_yaml(file, data)
    dvcfile = Dvcfile(dvc, file)
    with pytest.raises(StageFileFormatError):
        assert dvcfile.stages
    with pytest.raises(StageFileFormatError):
        assert dvcfile.validate(data, file)
Exemple #2
0
def test_stage_load_on_invalid_data(tmp_dir, dvc, file):
    data = {"is_this_a_valid_dvcfile": False}
    (tmp_dir / file).dump(data)
    dvcfile = Dvcfile(dvc, file)
    with pytest.raises(YAMLValidationError):
        assert dvcfile.stages
    with pytest.raises(YAMLValidationError):
        assert dvcfile.validate(data, file)
Exemple #3
0
def test_list():
    lst = [
        {
            OutputLOCAL.PARAM_PATH: "foo",
            RemoteLOCAL.PARAM_CHECKSUM: "123"
        },
        {
            OutputLOCAL.PARAM_PATH: "bar",
            RemoteLOCAL.PARAM_CHECKSUM: None
        },
        {
            OutputLOCAL.PARAM_PATH: "baz"
        },
    ]
    d = {Stage.PARAM_DEPS: lst}
    Dvcfile.validate(d)

    lst[0][OutputLOCAL.PARAM_CACHE] = True
    lst[1][OutputLOCAL.PARAM_CACHE] = False
    d = {Stage.PARAM_OUTS: lst}
    Dvcfile.validate(d)
Exemple #4
0
def test_empty_list():
    d = {Stage.PARAM_DEPS: []}
    Dvcfile.validate(d)

    d = {Stage.PARAM_OUTS: []}
    Dvcfile.validate(d)
Exemple #5
0
def test_none():
    Dvcfile.validate({Stage.PARAM_DEPS: None})
    Dvcfile.validate({Stage.PARAM_OUTS: None})
Exemple #6
0
def test_object():
    with pytest.raises(StageFileFormatError):
        Dvcfile.validate({Stage.PARAM_DEPS: {}})

    with pytest.raises(StageFileFormatError):
        Dvcfile.validate({Stage.PARAM_OUTS: {}})
Exemple #7
0
def test_cmd_str():
    Dvcfile.validate({Stage.PARAM_CMD: "cmd"})
Exemple #8
0
def test_no_cmd():
    Dvcfile.validate({})
Exemple #9
0
def test_cmd_none():
    Dvcfile.validate({Stage.PARAM_CMD: None})
Exemple #10
0
def test_cmd_obj():
    with pytest.raises(StageFileFormatError):
        Dvcfile.validate({Stage.PARAM_CMD: {}})