Debian Codegraph @

testsuite/tests/monorepo/subdir-in-tar/test.py

raw
1 """
2 Test that "subdir" is rejected for source archive origins
3 """
4
5 from drivers.alr import init_local_crate, run_alr, alr_submit
6 from glob import glob
7 from shutil import copyfile
8 from subprocess import run
9
10 import drivers.helpers
11 import os
12
13 # Prepare our "remote" repo
14 init_local_crate("xxx", enter=True)
15
16 # Publish it. We need to give input to alr, so we directly call it. We use the
17 # generated location as the "online" location, and this works because we are
18 # forcing.
19 p = run(["alr", "-q", "-f", "-n", "publish", "--skip-build", "--tar"],
20 input=f"file:{os.getcwd()}/alire/archives/xxx-0.1.0-dev.tbz2\n".encode())
21 p.check_returncode()
22
23 # Add improper subdir to manifest
24 with open("alire/releases/xxx-0.1.0-dev.toml", "at") as file:
25 file.write("subdir='.'\n")
26
27 # Submit manifest to index
28 os.chdir("..")
29 alr_submit("xxx/alire/releases/xxx-0.1.0-dev.toml", "my_index")
30
31 # Should complain on subdir field
32 p = run_alr("show", "xxx", complain_on_error=False)
33 assert "forbidden extra entries: subdir" in p.out, \
34 "Unexpected output: " + p.out
35
36 print('SUCCESS')