Exemplo n.º 1
0
def test_config_reading_default_file():
    """Test that the Config will work with a default file."""
    config = Config(APP_NAME,
                    APP_AUTHOR,
                    'test_config',
                    default=os.path.join(TEST_DATA_DIR, 'configrc'))
    config.read_default_config()
    assert config.data == DEFAULT_CONFIG
Exemplo n.º 2
0
def test_config_reading_configspec():
    """Test that the Config default file will work with a configspec."""
    config = Config(APP_NAME,
                    APP_AUTHOR,
                    'test_config',
                    validate=True,
                    default=os.path.join(TEST_DATA_DIR, 'configspecrc'))
    config.read_default_config()
    assert config.data == DEFAULT_VALID_CONFIG
Exemplo n.º 3
0
def test_config_reading_configspec_with_error():
    """Test that reading an invalid configspec raises and exception."""
    with pytest.raises(DefaultConfigValidationError):
        config = Config(APP_NAME,
                        APP_AUTHOR,
                        'test_config',
                        validate=True,
                        default=os.path.join(TEST_DATA_DIR,
                                             'invalid_configspecrc'))
        config.read_default_config()