def test_load_file__validate_on_update_is_true(tmpdir, valid, invalid):
    """
    When `Dynaconf(validate_on_update=True)`
    Should behave correctly (bypass, pass or raise)
    """
    # setup files
    file_with_valid = mkfile(tmpdir, valid["fname"], valid["data"])
    file_with_invalid = mkfile(tmpdir, invalid["fname"], invalid["data"])

    # setup dyna
    settings = Dynaconf(validate_on_update=True)
    settings.validators.register(Validator("value_a", must_exist=True))

    # should bypass when
    settings.load_file(file_with_invalid, validate=False)

    # should raise
    with pytest.raises(ValidationError):
        settings.load_file(file_with_invalid)

    # should pass
    assert not settings.exists("value_a")
    settings.load_file(file_with_valid)

    When `Dynaconf(validate_on_update=True)`
    Should behave correctly (bypass, pass or raise)
    
tests/test_base.py