Belle II Software  light-2403-persian
test_b2help_recommendation.py
1 
8 
9 '''
10 Test for checking:
11  - b2help-recommendation
12  - b2help-recommendation -t gamma
13 '''
14 
15 
16 import subprocess
17 import shlex
18 
19 
20 def 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 
32 if __name__ == '__main__':
33  check_tags = ['all', 'gamma', 'Tracking']
34  # List available tags
35  call_command('b2help-recommendation -l framework/tests/test_b2help_recommendation_payload.json')
36  # Call the script for tags
37  for tag in check_tags:
38  call_command(f'b2help-recommendation -t {tag} -l framework/tests/test_b2help_recommendation_payload.json')
39  # Call convert to payload
40  call_command(f'b2help-recommendation -l framework/tests/test_b2help_recommendation_payload.json -t {check_tags[1]} -c -p test')