From 84d671927ddab3806b725604cc1334d6fd1455af Mon Sep 17 00:00:00 2001 From: Devesh Kumar Singh Date: Sun, 7 Jun 2020 16:09:17 +0530 Subject: [PATCH] Add test to verify global config file path --- tests/functional/test_configuration.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/functional/test_configuration.py b/tests/functional/test_configuration.py index 4c263516e46..63b243f788e 100644 --- a/tests/functional/test_configuration.py +++ b/tests/functional/test_configuration.py @@ -141,3 +141,15 @@ def test_site_values(self, script, virtualenv): assert "global.timeout: 60" in result.stdout assert "freeze.timeout: 10" in result.stdout assert re.search(r"site:\n( .+\n)+", result.stdout) + + def test_global_config_file(self, script): + """Test that the system-wide configuration can be identified""" + + # We cannot write to system-wide files which might have permissions + # defined in a way that the tox virtualenvcannot write to those + # locations. Additionally we cannot patch those paths since pip config + # commands runs inside a subprocess. + # So we just check if the file can be identified + global_config_file = get_configuration_files()[kinds.GLOBAL][0] + result = script.pip("config", "debug") + assert "{}, exists:".format(global_config_file) in result.stdout