Belle II Software  release-08-01-10
basf2_args.py
1 #!/usr/bin/env python3
2 
3 
10 
11 import basf2
12 import b2test_utils
13 import subprocess
14 import os
15 
16 # disable pager when running these interactively
17 os.environ['PAGER'] = "cat"
18 
19 success = [
20  ['--info'],
21  ['--version'],
22  ['--help'],
23  ['-m', 'RootOutput'],
24  ['--dry-run', 'root_input.py', '-i', 'miep.root'],
25  ['--dry-run', 'root_input.py'],
26 ]
27 error = [
28  ['-m', 'NonExistingModule'],
29  ['--thisdoesntexist'],
30  ['/this/path/doesnt/exist.py'],
31  ['h͌̉e̳̞̞͆ͨ̏͋̕c͟o͛҉̟̰̫͔̟̪̠m̴̀ͯ̿͌ͨ̃͆e̡̦̦͖̳͉̗ͨͬ̑͌̃ͅt̰̝͈͚͍̳͇͌h̭̜̙̦̣̓̌̃̓̀̉͜'],
32 ]
33 
34 test_dir = basf2.find_file("/framework/tests")
35 with b2test_utils.working_directory(test_dir):
36  for arguments in success:
37  assert 0 == subprocess.run(['basf2'] + arguments).returncode
38 
39  for arguments in error:
40  assert 0 != subprocess.run(['basf2'] + arguments).returncode
def working_directory(path)
Definition: __init__.py:170