diff --git a/testsuite/tests/get/git-local/test.py b/testsuite/tests/get/git-local/test.py index a1ecf5436..fa4db525b 100644 --- a/testsuite/tests/get/git-local/test.py +++ b/testsuite/tests/get/git-local/test.py @@ -2,10 +2,7 @@ Retrieve a release from a local git repository """ -from glob import glob - -from drivers.alr import run_alr -from drivers.asserts import assert_match +from drivers.alr import alr_with, init_local_crate, run_alr from drivers.helpers import compare, contents # Get the release @@ -37,4 +34,9 @@ ]) +# Use release as dependency +init_local_crate() +alr_with("libfoo") # Should succeed + + print('SUCCESS') diff --git a/testsuite/tests/misc/git-ungit/test.py b/testsuite/tests/misc/git-ungit/test.py index a71b7847b..88ddb010d 100644 --- a/testsuite/tests/misc/git-ungit/test.py +++ b/testsuite/tests/misc/git-ungit/test.py @@ -4,24 +4,40 @@ import os import shutil -from glob import glob -from drivers.alr import crate_dirname, run_alr +from drivers.alr import alr_with, crate_dirname, init_local_crate, run_alr from drivers.asserts import assert_file_exists # By default, git deployments are shallow and see their .git directory removed # Check that and that enabling legacy behavior works cwd = os.getcwd() +foo_dir = crate_dirname("libfoo") -run_alr("get", "hello") -os.chdir(crate_dirname("hello")) +# By default .git should not be there +for wanted in [False, True]: + run_alr("get", "libfoo") -# Check root gotten crate -assert_file_exists(".git", wanted=False) + # Check root gotten crate + assert_file_exists(os.path.join(foo_dir, ".git"), + wanted=wanted) -# Check dependency -os.chdir(os.path.join("alire", "cache", "dependencies")) -assert_file_exists(os.path.join(glob("libhello*")[0], ".git"), wanted=False) + # Check as dependency + init_local_crate() + alr_with("libfoo") + + assert_file_exists(os.path.join("alire", "cache", "dependencies", + foo_dir, ".git"), + wanted=wanted) + + if not wanted: + # Enable for next round + run_alr("config", "--global", "--set", + "dependencies.git.keep_repository", "true") + + # Cleanup for next round + os.chdir(cwd) + shutil.rmtree(crate_dirname("libfoo")) + shutil.rmtree("xxx") print('SUCCESS') diff --git a/testsuite/tests/misc/git-ungit/test.yaml b/testsuite/tests/misc/git-ungit/test.yaml index 872fc1274..8293fdcee 100644 --- a/testsuite/tests/misc/git-ungit/test.yaml +++ b/testsuite/tests/misc/git-ungit/test.yaml @@ -1,3 +1,3 @@ driver: python-script indexes: - basic_index: {} + git_index: {}