12 self.assertEqual(component.name,
'component_name')
13 self.assertEqual(component.seed, 1)
14 self.assertEqual(component.inputs, [])
15 self.assertEqual(component.outputs,
None)
16 self.assertEqual(component.ignore_job_params, [])
17 self.assertEqual(component.hpsmc_dir, os.getenv(
"HPSMC_DIR",
None))
21 self.assertEqual(component.required_parameters(), [])
25 self.assertEqual(component.optional_parameters(), [
'nevents',
'seed'])
29 self.assertEqual(component.required_config(), [])
32 component =
Component(
'component_name', inputs=[
'input1',
'input2'])
33 self.assertEqual(component.input_files(), [
'input1',
'input2'])
36 component =
Component(
'component_name', inputs=[
'input1.stdhep',
'input2.stdhep'])
37 self.assertEqual(component._inputs_to_outputs(), [
'input1.stdhep',
'input2.stdhep'])
40 component =
Component(
'component_name', inputs=[
'input1.stdhep',
'input2.stdhep'])
41 component.append_tok =
'tok'
42 component.output_ext =
'.ext'
43 self.assertEqual(component._inputs_to_outputs(), [
'input1_tok.ext',
'input2_tok.ext'])
46 component =
Component(
'component_name', outputs=[
'output1',
'output2'])
47 self.assertEqual(component.output_files(), [
'output1',
'output2'])
50 component =
Component(
'component_name', inputs=[
'input1.stdhep',
'input2.stdhep'])
51 component.append_tok =
'tok'
52 component.output_ext =
'.ext'
53 self.assertEqual(component.output_files(), [
'input1_tok.ext',
'input2_tok.ext'])
57 component.set_parameters({
'nevents': 10,
'seed': 2})
58 self.assertEqual(component.nevents, 10)
59 self.assertEqual(component.seed, 2)
62 component =
Component(
'component_name', ignore_job_params=[
'nevents'])
63 component.set_parameters({
'nevents': 10,
'seed': 2})
64 self.assertEqual(component.nevents,
None)
65 self.assertEqual(component.seed, 2)
69 parser = configparser.ConfigParser()
70 config_file = [
'test_helpers/.hpsmc_test_cfg']
71 parser.read(config_file)
72 component.config(parser)
73 self.assertEqual(component.hps_java_bin_jar,
'some/path/to/hps-java-bin.jar')
74 self.assertEqual(component.lcio_bin_jar,
'some/path/to/lcio-bin.jar')
78 self.assertEqual(component.cmd_args(), [])
81 component =
Component(
'component_name', command=
'some_command')
82 self.assertEqual(component.cmd_line_str(),
'some_command')
85 if __name__ ==
'__main__':
Base class for components in a job.
def test_required_config(self)
def test_cmd_line_str(self)
def test_set_parameters_ignore(self)
def test_required_params(self)
def test_set_parameters(self)
def test_input_files(self)
def test_inputs_to_outputs_extension(self)
def test_inputs_to_outputs(self)
def test_output_files(self)
def test_output_files_from_inputs(self)
def test_optional_params(self)