def test_add_user_config(): """Test that the Config module adds user levels that inherit from base levels.""" base_config_file = os.path.join(os.path.dirname(__file__), "rsc", "config.yaml") user_config_file = os.path.join(os.path.dirname(__file__), "rsc", "user.yaml") config = Config(base_config_file, user_config_file) flags = config.get_tool_config("catkin_lint", "custom", "flags") assert flags == "--unit_test" flags = config.get_tool_config("make", "custom", "flags") assert "-Wall" in flags
def test_user_level_override_base_level_with_same_name(): """Test that user level that overrides a base level with same name finds flags..""" base_config_file = os.path.join(os.path.dirname(__file__), "rsc", "config.yaml") user_config_file = os.path.join( os.path.dirname(__file__), "rsc", "user-level-same-name.yaml" ) config = Config(base_config_file, user_config_file) flags = config.get_tool_config("pylint", "threshold", "flags") assert flags == "--user-override" flags = config.get_tool_config("make", "threshold", "flags") assert flags is None
def test_user_level_extends_override_level(): """Test that user level extends a level that overrides a base level.""" base_config_file = os.path.join(os.path.dirname(__file__), "rsc", "config.yaml") user_config_file = os.path.join( os.path.dirname(__file__), "rsc", "user-extend.yaml" ) config = Config(base_config_file, user_config_file) flags = config.get_tool_config("pylint", "sei_cert", "flags") assert flags == "--user-override" flags = config.get_tool_config("make", "sei_cert", "flags") assert "-Wall" in flags
def test_user_level_overrides_base_level(): """Test that user level overrides base level in configuration.""" base_config_file = os.path.join(os.path.dirname(__file__), "rsc", "config.yaml") user_config_file = os.path.join( os.path.dirname(__file__), "rsc", "user-override.yaml" ) config = Config(base_config_file, user_config_file) flags = config.get_tool_config("pylint", "sei_cert", "flags") assert flags == "--user-override" flags = config.get_tool_config("make", "sei_cert", "flags") assert flags is None
def test_config_get_tool_config(): """ Test that the Config module gives correct config for tools. Expected result: tool plugin configuration matches config file """ config_file = os.path.join(os.path.dirname(__file__), "rsc", "config.yaml") config = Config(config_file) tool_config = config.get_tool_config("make", "example", "flags") assert "-Wall" in tool_config