Belle II Software light-2405-quaxo
test_b2help_recommendation.py
1
8
9'''
10Test for checking:
11 - b2help-recommendation
12 - b2help-recommendation -t gamma
13'''
14
15import basf2
16import subprocess
17import shlex
18
19
20def call_command(command):
21 """Call command print output after having removed some lines from output
22
23 Args:
24 command (string): command to be called
25 """
26 output = subprocess.check_output(shlex.split(command), encoding='utf-8').strip().split('\n')
27 for line in output:
28 if "provider = " not in line:
29 print(line)
30
31
32if __name__ == '__main__':
33 check_tags = ['all', 'gamma', 'Tracking']
34 filename = basf2.find_file('framework/tests/test_b2help_recommendation_payload.json')
35 # List available tags
36 call_command(f'b2help-recommendation -l {filename}')
37 # Call the script for tags
38 for tag in check_tags:
39 call_command(f'b2help-recommendation -t {tag} -l {filename}')
40 # Call convert to payload
41 call_command(f'b2help-recommendation -l {filename} -t {check_tags[1]} -c -p test')