| 1 |
""" |
| 2 |
Test that Alire properly reports an invalid index URL. |
| 3 |
""" |
| 4 |
|
| 5 |
import os |
| 6 |
import re |
| 7 |
|
| 8 |
from e3.fs import rm |
| 9 |
|
| 10 |
from drivers.alr import prepare_indexes, run_alr |
| 11 |
from drivers.asserts import assert_match |
| 12 |
|
| 13 |
|
| 14 |
for d in ('no-such-directory', |
| 15 |
'file://no-such-directory', ): |
| 16 |
rm('alr-config', recursive=True) |
| 17 |
prepare_indexes('alr-config', '.', |
| 18 |
{'bad_index': {'dir': d, 'in_fixtures': False}}) |
| 19 |
p = run_alr("search", "--crates", complain_on_error=False, debug=False) |
| 20 |
|
| 21 |
path_excerpt = os.path.join('alr-config', 'indexes', 'bad_index', |
| 22 |
'index.toml') |
| 23 |
assert_match('ERROR: Cannot load metadata from .*{}:' |
| 24 |
' Not a readable directory' |
| 25 |
'\n' |
| 26 |
.format(re.escape(path_excerpt)), |
| 27 |
p.out) |
| 28 |
|
| 29 |
print('SUCCESS') |