Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
mosteo committed Sep 25, 2023
1 parent eb49f82 commit 25eec99
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 14 deletions.
10 changes: 6 additions & 4 deletions testsuite/tests/get/git-local/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,4 +34,9 @@
])


# Use release as dependency
init_local_crate()
alr_with("libfoo") # Should succeed


print('SUCCESS')
34 changes: 25 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,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')
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 25eec99

Please sign in to comment.