File: test.py

package info (click to toggle)
alire 1.2.1-2.1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 13,124 kB
  • sloc: ada: 77,497; python: 6,605; sh: 477; ansic: 347; makefile: 258; javascript: 87; xml: 40
file content (35 lines) | stat: -rw-r--r-- 941 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
"""
Check that alr exec runs commands within Alire environment/context
"""

from glob import glob
import os

from drivers.alr import run_alr
from drivers.asserts import assert_match

import re


# Get the "hello" project and enter its directory
run_alr('get', 'hello')
os.chdir(glob('hello*')[0])

p = run_alr('exec', 'echo', 'test string',
            quiet=False) # -q will hide the output of the exec command

assert_match('test string',
             p.out, flags=re.S)

# exec using -- to separate arguments to the spawned command
p = run_alr('exec', '--', 'sh', '-c',
            'echo "print GPR_PROJECT_PATH from'
            ' alire context:" ${GPR_PROJECT_PATH}',
            quiet=False) # -q will hide the output of the exec command

assert_match('.* GPR_PROJECT_PATH from alire context.*'
             'hello_[0-9\.]*_filesystem.*'
             'libhello_[0-9\.]*_filesystem.*',
             p.out, flags=re.S)

print('SUCCESS')