Rename site-wide to global

This commit is contained in:
Pradyun S. Gedam 2017-05-14 12:08:08 +05:30
parent e85e838d9c
commit c9113e41db
3 changed files with 12 additions and 11 deletions

View File

@ -129,7 +129,7 @@ class ConfigurationCommand(Command):
def _determine_file(self, options, need_value):
file_options = {
"user": options.user_file,
"site-wide": options.global_file,
"global": options.global_file,
"venv": options.venv_file
}

View File

@ -65,16 +65,17 @@ class Configuration(object):
def __init__(self, isolated, load_only=None):
super(Configuration, self).__init__()
if load_only not in ["user", "site-wide", "venv", None]:
if load_only not in ["user", "global", "venv", None]:
raise ConfigurationError(
"Got invalid value for load_only - should be one of 'user', "
"'site-wide', 'venv'"
"'global', 'venv'"
)
self.isolated = isolated
self.load_only = load_only
# The order here determines the override order.
self._override_order = ["site-wide", "user", "venv", "environment"]
self._override_order = ["global", "user", "venv", "environment"]
# Because we keep track of where we got the data from
self._parsers = {variant: [] for variant in self._override_order}
self._config = {variant: {} for variant in self._override_order}
@ -277,8 +278,8 @@ class Configuration(object):
else:
yield "environment", []
# at the base we have any site-wide configuration
yield "site-wide", list(site_config_files)
# at the base we have any global configuration
yield "global", list(site_config_files)
# per-user configuration next
should_load_user_config = not self.isolated and not (

View File

@ -13,7 +13,7 @@ from tests.lib.configuration_helpers import ConfigurationPatchingMixin
class TestConfigurationLoading(ConfigurationPatchingMixin):
def test_global_loading(self):
self.patch_configuration("site-wide", {"test.hello": 1})
self.patch_configuration("global", {"test.hello": 1})
self.configuration.load()
assert self.configuration.get_value("test.hello") == 1
@ -33,14 +33,14 @@ class TestConfigurationPrecedence(ConfigurationPatchingMixin):
# configuration options
def test_global_overriden_by_user(self):
self.patch_configuration("site-wide", {"test.hello": 1})
self.patch_configuration("global", {"test.hello": 1})
self.patch_configuration("user", {"test.hello": 2})
self.configuration.load()
assert self.configuration.get_value("test.hello") == 2
def test_global_overriden_by_venv(self):
self.patch_configuration("site-wide", {"test.hello": 1})
self.patch_configuration("global", {"test.hello": 1})
self.patch_configuration("venv", {"test.hello": 3})
self.configuration.load()
@ -54,7 +54,7 @@ class TestConfigurationPrecedence(ConfigurationPatchingMixin):
assert self.configuration.get_value("test.hello") == 3
def test_global_not_overriden_by_environment(self):
self.patch_configuration("site-wide", {"test.hello": 1})
self.patch_configuration("global", {"test.hello": 1})
os.environ["PIP_HELLO"] = "4"
self.configuration.load()
@ -122,7 +122,7 @@ class TestConfigurationModification(ConfigurationPatchingMixin):
def test_global_modification(self):
# get the path to local config file
self.configuration.load_only = "site-wide"
self.configuration.load_only = "global"
self.configuration.load()
# Mock out the method