Beispiel #1
0
def test_validate_dir_option_raises_exception_for_non_existing_dir_if_dir_should_exist():
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    with pytest.raises(SchemaError):
        validate_dir_option(dir_path, "dummy")
Beispiel #2
0
def test_validate_dir_option_does_not_raise_exception_for_non_existing_dir_if_dir_should_not_exist(
):
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    validate_dir_option(dir_path, "dummy", should_exist=False)
Beispiel #3
0
def test_validate_dir_option_raises_exception_for_non_existing_dir_if_dir_should_exist(
):
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    with pytest.raises(SchemaError):
        validate_dir_option(dir_path, "dummy")
Beispiel #4
0
def test_validate_dir_option_exception_message_contains_correct_info():
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    msg = "dummy"
    with pytest.raises(SchemaError) as exc_info:
        validate_dir_option(dir_path, msg)

    check_exception_message(exc_info, msg, dir_path)
Beispiel #5
0
def test_validate_dir_option_exception_message_contains_correct_info():
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    msg = "dummy"
    with pytest.raises(SchemaError) as exc_info:
        validate_dir_option(dir_path, msg)

    check_exception_message(exc_info, msg, dir_path)
Beispiel #6
0
def test_validate_dir_option_raises_exception_for_none_if_nullable_not_specified(
):
    with pytest.raises(SchemaError):
        validate_dir_option(None, "dummy")
Beispiel #7
0
def test_validate_dir_option_raises_exception_for_existing_dir_if_dir_should_not_exist(
):
    with temp_dir_created() as dir_path:
        with pytest.raises(SchemaError):
            validate_dir_option(dir_path, "dummy", should_exist=False)
Beispiel #8
0
def test_validate_dir_option_does_not_raise_exception_for_existing_dir_if_dir_should_exist(
):
    with temp_dir_created() as dir_path:
        validate_dir_option(dir_path, "dummy")
Beispiel #9
0
def test_validate_dir_option_does_not_raise_exception_for_none_if_nullable_specified(
):
    validate_dir_option(None, "dummy", nullable=True)
Beispiel #10
0
def test_validate_dir_option_does_not_raise_exception_for_none_if_nullable_specified():
    validate_dir_option(None, "dummy", nullable=True)
Beispiel #11
0
def test_validate_dir_option_raises_exception_for_none_if_nullable_not_specified():
    with pytest.raises(SchemaError):
        validate_dir_option(None, "dummy")
Beispiel #12
0
def test_validate_dir_option_raises_exception_for_existing_dir_if_dir_should_not_exist():
    with temp_dir_created() as dir_path:
        with pytest.raises(SchemaError):
            validate_dir_option(dir_path, "dummy", should_exist=False)
Beispiel #13
0
def test_validate_dir_option_does_not_raise_exception_for_non_existing_dir_if_dir_should_not_exist():
    dir_path = None
    with temp_dir_created() as dp:
        dir_path = dp

    validate_dir_option(dir_path, "dummy", should_exist=False)
Beispiel #14
0
def test_validate_dir_option_does_not_raise_exception_for_existing_dir_if_dir_should_exist():
    with temp_dir_created() as dir_path:
        validate_dir_option(dir_path, "dummy")