1
0
mirror of https://github.com/TheLocehiliosan/yadm synced 2026-03-02 03:49:29 +00:00

Properly handle missing "." in alternate conditions

This commit is contained in:
Tim Byrne
2019-10-12 09:14:45 -05:00
parent 4ea3ed9e2a
commit 6d5467951a
3 changed files with 6 additions and 2 deletions

View File

@@ -100,7 +100,8 @@ def test_alt_conditions(
@pytest.mark.usefixtures('ds1_copy')
@pytest.mark.parametrize('kind', ['builtin', '', 'envtpl', 'j2cli', 'j2'])
@pytest.mark.parametrize(
'kind', ['builtin', '', None, 'envtpl', 'j2cli', 'j2'])
@pytest.mark.parametrize('label', ['t', 'template', 'yadm', ])
def test_alt_templates(
runner, paths, kind, label):
@@ -108,6 +109,8 @@ def test_alt_templates(
yadm_dir = setup_standard_yadm_dir(paths)
suffix = f'##{label}.{kind}'
if kind is None:
suffix = f'##{label}'
utils.create_alt_files(paths, suffix)
run = runner([paths.pgm, '-Y', yadm_dir, 'alt'])
assert run.success

View File

@@ -59,7 +59,7 @@ def create_alt_files(paths, suffix,
# Do not test directory support for jinja alternates
test_paths = [new_file1, new_file2]
test_names = [ALT_FILE1, ALT_FILE2]
if not re.match(r'##(t|template|yadm)\.', suffix):
if not re.match(r'##(t$|t\.|template|yadm)', suffix):
test_paths += [new_dir]
test_names += [ALT_DIR]