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