mirror of https://github.com/pypa/pip
Add a test for environment config file
This commit is contained in:
parent
ac2e6e5610
commit
94d752e399
|
@ -2,6 +2,8 @@
|
|||
"""
|
||||
|
||||
import os
|
||||
import tempfile
|
||||
import textwrap
|
||||
from mock import MagicMock
|
||||
|
||||
from pip.locations import venv_config_file, new_config_file, site_config_files
|
||||
|
@ -27,6 +29,20 @@ class TestConfigurationLoading(ConfigurationPatchingMixin):
|
|||
self.configuration.load()
|
||||
assert self.configuration.get_value("test.hello") == "3"
|
||||
|
||||
def test_environment_config_loading(self):
|
||||
contents = textwrap.dedent("""\
|
||||
[test]
|
||||
hello = 4
|
||||
""")
|
||||
|
||||
_, config_file = tempfile.mkstemp('-pip.cfg', 'test-')
|
||||
os.environ["PIP_CONFIG_FILE"] = config_file
|
||||
with open(config_file, "w") as f:
|
||||
f.write(contents)
|
||||
|
||||
self.configuration.load()
|
||||
assert self.configuration.get_value("test.hello") == "4"
|
||||
|
||||
|
||||
class TestConfigurationPrecedence(ConfigurationPatchingMixin):
|
||||
# Tests for methods to that determine the order of precedence of
|
||||
|
|
Loading…
Reference in New Issue