| 1 |
""" |
| 2 |
Detect a crate with two pins in the manifest |
| 3 |
""" |
| 4 |
|
| 5 |
import os |
| 6 |
import re |
| 7 |
|
| 8 |
from drivers.alr import run_alr, alr_pin |
| 9 |
from drivers.asserts import assert_match |
| 10 |
from drivers.helpers import dir_separator |
| 11 |
|
| 12 |
|
| 13 |
# Initialize a workspace, enter, and add a regular dependency |
| 14 |
run_alr('init', '--bin', 'xxx') |
| 15 |
os.chdir('xxx') |
| 16 |
run_alr('with', 'libhello^1') |
| 17 |
|
| 18 |
# Pin to a version |
| 19 |
alr_pin('libhello', version='1.0') |
| 20 |
|
| 21 |
# Manually force a second pin |
| 22 |
with open("alire.toml", "at") as manifest: |
| 23 |
manifest.write("[[pins]]\n") |
| 24 |
manifest.write("libhello = { path = '.' }\n") |
| 25 |
|
| 26 |
# Check that the second pin is rejected |
| 27 |
p = run_alr('pin', complain_on_error=False) |
| 28 |
assert_match('.*pin for crate libhello is specified more than once.*', |
| 29 |
p.out) |
| 30 |
|
| 31 |
|
| 32 |
print('SUCCESS') |