diff --git a/tests/test_commands.py b/tests/test_commands.py index 6f600b9..712a764 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -22,6 +22,7 @@ import glob import os +import pathlib import shutil import json import yaml @@ -62,6 +63,19 @@ def test_checkout(changedir, tmpdir): assert not os.path.exists('build/sstate-cache') +def test_checkout_create_refs(changedir, tmpdir): + tpath = pathlib.Path(str(tmpdir.mkdir('test_commands'))) + repo_cache = pathlib.Path(str(tmpdir.mkdir('repos'))) + shutil.rmtree(str(tpath), ignore_errors=True) + shutil.copytree('tests/test_patch', str(tpath)) + os.chdir(str(tpath)) + os.environ['KAS_REPO_REF_DIR'] = str(repo_cache) + kas.kas(['checkout', 'test.yml']) + del os.environ['KAS_REPO_REF_DIR'] + assert os.path.exists(str(repo_cache / 'github.com.siemens.kas.git')) + assert os.path.exists('kas/.git/objects/info/alternates') + + def test_repo_includes(changedir, tmpdir): tdir = str(tmpdir.mkdir('test_commands')) shutil.rmtree(tdir, ignore_errors=True)