| 1 |
""" |
| 2 |
Test that `alr with --url` without explicit crate autodetects the target crate |
| 3 |
and correctly adds the pinned dependency |
| 4 |
""" |
| 5 |
|
| 6 |
import os |
| 7 |
import re |
| 8 |
|
| 9 |
from drivers.alr import run_alr |
| 10 |
from drivers.asserts import assert_match |
| 11 |
from drivers.helpers import dir_separator |
| 12 |
from glob import glob |
| 13 |
|
| 14 |
# Retrieve a crate |
| 15 |
run_alr('get', 'hello=1') |
| 16 |
target = glob('hello*')[0] |
| 17 |
|
| 18 |
# Initialize a workspace |
| 19 |
run_alr('init', '--bin', 'xxx') |
| 20 |
os.chdir('xxx') |
| 21 |
|
| 22 |
# Add the directory as pinned crate, with autodetection (no crate given, |
| 23 |
# inferred from the crate metadata found at target). |
| 24 |
run_alr('with', '--use', '..' + dir_separator() + target) |
| 25 |
|
| 26 |
# Verify that hello^1 is a new dependency and also that hello dependencies are |
| 27 |
# in the solution. |
| 28 |
p = run_alr('with', '--solve') |
| 29 |
assert_match('''Dependencies \(direct\): |
| 30 |
hello\^1\.0\.0 |
| 31 |
.*Dependencies \(solution\): |
| 32 |
hello=1\.0\.0 .* |
| 33 |
libhello=1\.1\.0 .*''', # we skip non-relevant details |
| 34 |
p.out, flags=re.S) |
| 35 |
|
| 36 |
print('SUCCESS') |