| 1 |
""" |
| 2 |
Test that publishing from a branch other than the default one works |
| 3 |
""" |
| 4 |
|
| 5 |
from drivers.alr import init_local_crate, run_alr |
| 6 |
from drivers.asserts import assert_match |
| 7 |
from drivers.helpers import init_git_repo |
| 8 |
from glob import glob |
| 9 |
from shutil import copyfile |
| 10 |
from subprocess import run |
| 11 |
|
| 12 |
import os |
| 13 |
|
| 14 |
# Prepare our "remote" repo |
| 15 |
init_local_crate("xxx", enter=False) |
| 16 |
head_commit = init_git_repo("xxx") |
| 17 |
|
| 18 |
# Clone to a "local" repo and set minimal config |
| 19 |
assert run(["git", "clone", "xxx", "xxx_local"]).returncode == 0 |
| 20 |
os.chdir("xxx_local") |
| 21 |
assert run(["git", "config", "user.email", "[email protected]"]).returncode == 0 |
| 22 |
assert run(["git", "config", "user.name", "Alire Testsuite"]).returncode == 0 |
| 23 |
|
| 24 |
# Check out a new branch, add some file and push it to the "remote" |
| 25 |
assert run(["git", "checkout", "-b", "devel"]).returncode == 0 |
| 26 |
copyfile("alire.toml", "noise.bin") |
| 27 |
assert run(["git", "add", "."]).returncode == 0 |
| 28 |
assert run(["git", "commit", "-m", "commit-msg"]).returncode == 0 |
| 29 |
assert run(["git", "push", "-u", "origin", "devel"]).returncode == 0 |
| 30 |
|
| 31 |
# Check that the publishing assistant completes without complaining |
| 32 |
run_alr("--force", "publish") |
| 33 |
|
| 34 |
print('SUCCESS') |