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