Debian Codegraph @

testsuite/tests/publish/missing-manifest/test.py

raw
1 """
2 Check detection of a remote without manifest. This was allowed in the past, so
3 legacy repositories that ignored the `alire.toml` file may run amok of this
4 test.
5 """
6
7 from drivers.alr import run_alr
8 from drivers.asserts import assert_match
9 from drivers.helpers import contents, content_of, init_git_repo, zip_dir
10 from shutil import copyfile, rmtree
11 from zipfile import ZipFile
12
13 import os
14
15
16 # Prepare a repo and a zipball to be used as "remote", without a manifest
17 run_alr("init", "--bin", "xxx")
18 # Remove the manifest
19 os.remove(os.path.join("xxx", "alire.toml"))
20
21 # Create the zip
22 zip_dir("xxx", "xxx.zip")
23
24 # A "remote" source archive. We force to allow the test to skip the remote
25 # check. Curl requires an absolute path to work.
26 target = os.path.join(os.getcwd(), "xxx.zip")
27 p = run_alr("publish", f"file:{target}", "--skip-build",
28 complain_on_error=False, force=True)
29
30 # Should fail reporting the missing manifest
31 assert_match(".*Remote sources are missing the 'alire.toml' manifest file.*",
32 p.out)
33
34 print('SUCCESS')