def test_validate_config_file_entries(self):
     with pytest.raises(
             ValueError,
             match=
             "unsupported key 'wrong_var' in config file tests/pytest.invalid.ini"
     ):
         settings = Settings({})
         settings.init_from_file('tests/pytest.invalid.ini')
예제 #2
0
def create_settings(config):
    plugins = config.pluginmanager.list_plugin_distinfo()
    plugins.sort(key=lambda item: item[1].project_name)
    settings = Settings({
        'enabled':
        config.option.enabled,
        'runner_name':
        'pytest',
        'runner_plugins':
        [(dist.project_name, dist.version) for plugin, dist in plugins],
        'runner_root':
        str(config.rootdir),
        'runner_version':
        pytest.__version__,
        'workers':
        config.option.workers,
    })
    settings.init_from_file('pytest.ini')
    return settings
 def test_get_variable_from_file(self):
     settings = Settings({})
     settings.init_from_file('pytest.ini')
     assert settings.system_provider == 'config-provider'