Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 23, 2023
1 parent eb49f82 commit e1aae91
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
33 changes: 24 additions & 9 deletions testsuite/tests/misc/git-ungit/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,39 @@

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)

# 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')
2 changes: 1 addition & 1 deletion testsuite/tests/misc/git-ungit/test.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
driver: python-script
indexes:
basic_index: {}
git_index: {}

0 comments on commit e1aae91

Please sign in to comment.