Parcourir la source

Rename COMPOSE_FILE_SEPARATOR -> COMPOSE_PATH_SEPARATOR
Add unit test

Signed-off-by: Joffrey F <[email protected]>

Joffrey F il y a 8 ans
Parent
commit
ac12ab95c4
2 fichiers modifiés avec 10 ajouts et 1 suppressions
  1. 1 1
      compose/cli/command.py
  2. 9 0
      tests/unit/cli/command_test.py

+ 1 - 1
compose/cli/command.py

@@ -54,7 +54,7 @@ def get_config_path_from_options(base_dir, options, environment):
 
     config_files = environment.get('COMPOSE_FILE')
     if config_files:
-        pathsep = environment.get('COMPOSE_FILE_SEPARATOR', os.pathsep)
+        pathsep = environment.get('COMPOSE_PATH_SEPARATOR', os.pathsep)
         return config_files.split(pathsep)
     return None
 

+ 9 - 0
tests/unit/cli/command_test.py

@@ -45,6 +45,15 @@ class TestGetConfigPathFromOptions(object):
                 '.', {}, environment
             ) == ['one.yml', 'two.yml']
 
+    def test_multiple_path_from_env_custom_separator(self):
+        with mock.patch.dict(os.environ):
+            os.environ['COMPOSE_PATH_SEPARATOR'] = '^'
+            os.environ['COMPOSE_FILE'] = 'c:\\one.yml^.\\semi;colon.yml'
+            environment = Environment.from_env_file('.')
+            assert get_config_path_from_options(
+                '.', {}, environment
+            ) == ['c:\\one.yml', '.\\semi;colon.yml']
+
     def test_no_path(self):
         environment = Environment.from_env_file('.')
         assert not get_config_path_from_options('.', {}, environment)