Belle II Software development
test_module_log_level_run.py
1#!/usr/bin/env python3
2# -*- coding: utf-8 -*-
3import subprocess
4
5for i in ['INFO', 'WARNING', 'ERROR', 'DEBUG']:
6 i_aux = f'EventInfoPrinter:{i}'
7 result = subprocess.run(['basf2', 'framework/tests/test_module_log_level.py',
8 '--module_log_level', f'{i_aux}'], capture_output=True, text=True)
9
10 result = result.stdout
11
12 start = 'Log-level for module EventInfoPrinter: '
13 end = '\n[INFO]'
14 idx1 = result.find(start)
15 idx2 = result.find(end, idx1+len(start))
16 res = result[idx1+len(start):idx2]
17
18 print(i, res)
19 if i == res:
20 print('Module log-level set correctly')