15test parsing of local database files
18from basf2
import logging, LogLevel, LogInfo
20from b2test_utils
import clean_working_directory, run_in_subprocess, configure_logging_for_tests
23ROOT.gInterpreter.Declare(
"#include <framework/database/TestingPayloadStorage.h>")
27dbstore/empty 1 -1,-1,-1,-1
28dbstore/good 1 0,0,-1,-1
29dbstore/good_tabs\t1\t0,0,-1,-1
30dbstore/good_many_spaces 1\t\t\t\t\t\t\t0,1,2,3
31dbstore/good_with_comment 1 0,1,2,3
32dbstory/good_with_md5 0123456789ABCDEF 0,1,2,3
33dbstore/no_revision 0,1,2,3
37dbstore/iov_only_2 1 0,0
38dbstore/iov_only_3 1 0,0,0
39dbstore/bad_with_spaces_02 1 0 ,1,2,3
40dbstore/bad_with_spaces_11 1 0, 1,2,3
41dbstore/bad_with_spaces_12 1 0,1 ,2,3
42dbstore/bad_with_spaces_21 1 0,1, 2,3
43dbstore/bad_with_spaces_22 1 0,1,2 ,3
44dbstore/bad_with_spaces_31 1 0,1,2, 3
45dbstore/bad_text_exp1 1 exp1,0,0,0
46dbstore/bad_text_run1 1 0,run1,0,0
47dbstore/bad_text_exp2 1 0,0,exp2,0
48dbstore/bad_text_run2 1 0,0,0,run2
54# modify logging to remove the useless module: lines
55for level in LogLevel.values.values():
56 logging.set_info(level, LogInfo.LEVEL | LogInfo.MESSAGE)
58logging.enable_summary(False)
59logging.log_level = LogLevel.DEBUG
60logging.debug_level = 39
61evt = ROOT.Belle2.EventMetaData(0, 0, 0)
62payload = ROOT.Belle2.Conditions.PayloadMetadata(
"test")
64with clean_working_directory():
65 configure_logging_for_tests()
66 for i, entry
in enumerate(entries.splitlines(
True)):
67 print(
"testing", repr(entry))
68 filename = f
"database-{i:02}.txt"
69 with open(filename,
"w")
as f:
73 entries = parse_testing_payloads_file(filename, check_existing=
False)
77 storage = ROOT.Belle2.Conditions.TestingPayloadStorage(filename)
78 run_in_subprocess(evt, payload, target=storage.get)