Debian Codegraph @

testsuite/tests/publish/local-repo-nonstd/test.py

raw
1 """
2 Test proper publishing using a local repo as reference with custom manifest
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 rmtree
10 from subprocess import run
11
12 import os
13
14
15 def verify_manifest():
16 target = os.path.join("alire", "releases", "xxx-0.1.0-dev.toml")
17 assert os.path.isfile(target), \
18 "Index manifest not found at expected location"
19 # Clean up for next test
20 rmtree(os.path.join("alire", "releases"))
21
22
23 # Prepare our "remote" repo, changing the manifest name to "xxx.toml"
24 init_local_crate("xxx")
25 os.rename("alire.toml", "xxx.toml")
26 os.chdir("..")
27 head_commit = init_git_repo("xxx")
28
29 # Clone to a "local" repo and set minimal config
30 assert run(["git", "clone", "xxx", "xxx_local"]).returncode == 0
31 os.chdir("xxx_local")
32 assert run(["git", "config", "user.email", "[email protected]"]).returncode == 0
33 assert run(["git", "config", "user.name", "Alire Testsuite"]).returncode == 0
34
35 # Tests with different default arguments that must all succeed
36 run_alr("--force", "publish", "--manifest", "xxx.toml")
37 verify_manifest()
38
39 run_alr("--force", "publish", ".", "--manifest", "xxx.toml")
40 verify_manifest()
41
42 run_alr("--force", "publish", ".", "master", "--manifest", "xxx.toml")
43 verify_manifest()
44
45 run_alr("--force", "publish", ".", "HEAD", "--manifest", "xxx.toml")
46 verify_manifest()
47
48 # Test that not setting the custom manifest results in failure
49 p = run_alr("--force", "publish", complain_on_error=False)
50 assert_match(".*No Alire workspace found.*", p.out)
51
52 print('SUCCESS')