4 from hpsmc.tools import LCIOTool, LCIOConcat, LCIOCount, LCIOMerge
11 self.assertEqual(lcio_tool.command,
"java")
15 self.assertEqual(lcio_tool.required_parameters(), [])
19 self.assertEqual(lcio_tool.required_config(), [
"lcio_bin_jar"])
23 parser = configparser.ConfigParser()
24 config_file = [
'test_helpers/.hpsmc_test_cfg']
25 parser.read(config_file)
26 lcio_tool.config(parser)
27 self.assertEqual(lcio_tool.lcio_bin_jar,
"some/path/to/lcio-bin.jar")
30 lcio_tool =
LCIOTool(name=
"lcio_tool")
31 parser = configparser.ConfigParser()
32 config_file = [
'test_helpers/.hpsmc_test_cfg']
33 parser.read(config_file)
34 lcio_tool.config(parser)
35 self.assertEqual(lcio_tool.cmd_args(), [
"-jar",
"some/path/to/lcio-bin.jar",
"lcio_tool"])
42 self.assertEqual(lcio_concat.name,
"concat")
43 self.assertEqual(lcio_concat.command,
"java")
46 lcio_concat =
LCIOConcat(inputs=[
"some/path/to/input1.slcio",
"some/path/to/input2.slcio"], outputs=[
"some/path/to/output.slcio"])
47 parser = configparser.ConfigParser()
48 config_file = [
'test_helpers/.hpsmc_test_cfg']
49 parser.read(config_file)
50 lcio_concat.config(parser)
51 self.assertEqual(lcio_concat.cmd_args(), [
"-jar",
"some/path/to/lcio-bin.jar",
"concat",
"-f",
"some/path/to/input1.slcio",
"-f",
"some/path/to/input2.slcio",
"-o",
"some/path/to/output.slcio"])
54 lcio_concat =
LCIOConcat(outputs=[
"some/path/to/output.slcio"])
55 parser = configparser.ConfigParser()
56 config_file = [
'test_helpers/.hpsmc_test_cfg']
57 parser.read(config_file)
58 lcio_concat.config(parser)
59 self.assertRaises(Exception,
lambda: lcio_concat.cmd_args(),
"Missing at least one input file.")
62 lcio_concat =
LCIOConcat(inputs=[
"some/path/to/input1.slcio",
"some/path/to/input2.slcio"])
63 parser = configparser.ConfigParser()
64 config_file = [
'test_helpers/.hpsmc_test_cfg']
65 parser.read(config_file)
66 lcio_concat.config(parser)
67 self.assertRaises(Exception,
lambda: lcio_concat.cmd_args(),
"Missing an output file.")
74 self.assertEqual(lcio_count.name,
"count")
75 self.assertEqual(lcio_count.command,
"java")
79 self.assertEqual(lcio_count.required_parameters(), [])
83 self.assertEqual(lcio_count.optional_parameters(), [])
86 lcio_count =
LCIOCount(inputs=[
"some/path/to/input.slcio"])
87 parser = configparser.ConfigParser()
88 config_file = [
'test_helpers/.hpsmc_test_cfg']
89 parser.read(config_file)
90 lcio_count.config(parser)
91 self.assertEqual(lcio_count.cmd_args(), [
"-jar",
"some/path/to/lcio-bin.jar",
"count",
"-f",
"some/path/to/input.slcio"])
95 parser = configparser.ConfigParser()
96 config_file = [
'test_helpers/.hpsmc_test_cfg']
97 parser.read(config_file)
98 lcio_count.config(parser)
99 self.assertRaises(Exception,
lambda: lcio_count.cmd_args(),
"Missing an input file.")
106 self.assertEqual(lcio_merge.name,
"merge")
107 self.assertEqual(lcio_merge.command,
"java")
110 lcio_merge =
LCIOMerge(inputs=[
"some/path/to/input1.slcio",
"some/path/to/input2.slcio"], outputs=[
"some/path/to/output.slcio"], nevents=100)
111 parser = configparser.ConfigParser()
112 config_file = [
'test_helpers/.hpsmc_test_cfg']
113 parser.read(config_file)
114 lcio_merge.config(parser)
115 self.assertEqual(lcio_merge.cmd_args(), [
"-jar",
"some/path/to/lcio-bin.jar",
"merge",
"-f",
"some/path/to/input1.slcio",
"-f",
"some/path/to/input2.slcio",
"-o",
"some/path/to/output.slcio",
"-n",
"100"])
118 lcio_merge =
LCIOMerge(outputs=[
"some/path/to/output.slcio"], nevents=100)
119 parser = configparser.ConfigParser()
120 config_file = [
'test_helpers/.hpsmc_test_cfg']
121 parser.read(config_file)
122 lcio_merge.config(parser)
123 self.assertRaises(Exception,
lambda: lcio_merge.cmd_args(),
"Missing at least one input file.")
126 lcio_merge =
LCIOMerge(inputs=[
"some/path/to/input1.slcio",
"some/path/to/input2.slcio"], nevents=100)
127 parser = configparser.ConfigParser()
128 config_file = [
'test_helpers/.hpsmc_test_cfg']
129 parser.read(config_file)
130 lcio_merge.config(parser)
131 self.assertRaises(Exception,
lambda: lcio_merge.cmd_args(),
"Missing an output file.")
134 if __name__ ==
'__main__':