@@ -589,6 +589,29 @@ def test_config_precedence():
589589 assert cfg (f = LOCAL )['pytest' ]['precedence' ] == 'local'
590590
591591
592+ TEST_CASES_CONFIG_RELATIVE = [
593+ # (flag, env_var)
594+ ('--local' , 'WEST_CONFIG_LOCAL' ),
595+ ('--system' , 'WEST_CONFIG_SYSTEM' ),
596+ ('--global' , 'WEST_CONFIG_GLOBAL' ),
597+ ]
598+
599+
600+ @pytest .mark .parametrize ("test_case" , TEST_CASES_CONFIG_RELATIVE )
601+ def test_config_relative_paths (test_case , config_tmpdir ):
602+ flag , env_var = test_case
603+
604+ # one relative config file path is specified
605+ os .environ [env_var ] = 'config1'
606+ _ , stderr = cmd_raises (f'config { flag } some.key' , WestNotFound )
607+ assert f"config file path(s) must be absolute: '{ os .environ [env_var ]} '" in stderr
608+
609+ # one of multiple config file paths is relative
610+ os .environ [env_var ] = f'config1{ os .pathsep } config2'
611+ _ , stderr = cmd_raises (f'config { flag } some.key' , WestNotFound )
612+ assert f"config file path(s) must be absolute: '{ os .environ [env_var ]} '" in stderr
613+
614+
592615def test_config_multiple (config_tmpdir ):
593616 # Verify that local settings take precedence over global ones,
594617 # but that both values are still available, and that setting
0 commit comments