-
-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
with
directory with autodetection of crate
When adding a dependency as a pinned dir, and the target dir is a regular Alire crate, we can autodetect the crate we are adding as dependency. In that case the command becomes `alr with --url <url>`. This can also be useful in the future for remote URLs that will also provide the crate being retrieved.
- Loading branch information
Showing
5 changed files
with
82 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
""" | ||
Test that `alr with --url` without explicit crate autodetects the target crate | ||
and correctly adds the pinned dependency | ||
""" | ||
|
||
import os | ||
import re | ||
|
||
from drivers.alr import run_alr | ||
from drivers.asserts import assert_match | ||
from drivers.helpers import path_separator | ||
from glob import glob | ||
|
||
# Retrieve a crate | ||
run_alr('get', 'hello=1') | ||
target = glob('hello*')[0] | ||
|
||
# Initialize a workspace | ||
run_alr('init', '--bin', 'xxx') | ||
os.chdir('xxx') | ||
|
||
# Add the directory as pinned crate, with autodetection (no crate given, | ||
# inferred from the crate metadata found at target). | ||
run_alr('with', '--url', '..' + path_separator() + target) | ||
|
||
# Verify that hello^1 is a new dependency and also that hello dependencies are | ||
# in the solution. | ||
p = run_alr('with', '--solve') | ||
assert_match('''Dependencies \(direct\): | ||
hello\^1\.0\.0 | ||
.*Dependencies \(solution\): | ||
hello=1\.0\.0 .* | ||
libhello=1\.1\.0 .*''', # we skip non-relevant details | ||
p.out, flags=re.S) | ||
|
||
print('SUCCESS') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
driver: python-script | ||
indexes: | ||
solver_index: | ||
in_fixtures: true |