Ejemplo n.º 1
0
    def test_custom_path_precedence(self):
        with TempDir() as d:
            template_file = path_join(d, 'init_config', 'tags.yaml')
            ensure_parent_dir_exists(template_file)
            write_file(template_file, 'test:\n- foo\n- bar')

            templates = ConfigTemplates([d])

            assert templates.load('init_config/tags') == {'test': ['foo', 'bar']}
Ejemplo n.º 2
0
    def test_parse_error(self):
        with TempDir() as d:
            template_file = path_join(d, 'invalid.yaml')
            ensure_parent_dir_exists(template_file)
            write_file(template_file, '> invalid')

            templates = ConfigTemplates([d])

            with pytest.raises(ValueError, match='^Unable to parse template `{}`'.format(re.escape(template_file))):
                templates.load('invalid')