| 1 |
""" |
| 2 |
Check that unknown properties can be force-ignored |
| 3 |
""" |
| 4 |
|
| 5 |
from drivers.alr import run_alr |
| 6 |
from drivers.asserts import assert_match |
| 7 |
from os import chdir |
| 8 |
|
| 9 |
import re |
| 10 |
|
| 11 |
# Create a regular working release |
| 12 |
run_alr("init", "--bin", "xxx") |
| 13 |
chdir("xxx") |
| 14 |
|
| 15 |
# Add spurious metadata |
| 16 |
with open("alire.toml", "r") as file: |
| 17 |
lines = file.readlines() |
| 18 |
with open("alire.toml", "w") as file: |
| 19 |
file.write("fancy-new-feat = false\n") |
| 20 |
file.writelines(lines) |
| 21 |
|
| 22 |
# Verify the regular error |
| 23 |
p = run_alr('show', complain_on_error=False) |
| 24 |
assert p.status != 0, "command should have errored" |
| 25 |
assert_match(".*invalid property:.*", p.out, flags=re.S) |
| 26 |
|
| 27 |
# Verify the force-ignore |
| 28 |
p = run_alr('show', quiet=False, force=True) # Should not complain |
| 29 |
assert_match(".*Warning:.*invalid property:.*", # Should be a warning |
| 30 |
p.out, flags=re.S) |
| 31 |
|
| 32 |
print("SUCCESS") |