12 self.assertEqual(slic.name,
'slic')
16 parser = configparser.ConfigParser()
17 config_file = [
'test_helpers/.hpsmc_test_cfg']
18 parser.read(config_file)
20 self.assertEqual(slic.detector_dir,
'some/detector/dir')
21 self.assertEqual(slic.hps_fieldmaps_dir,
'some/fieldmaps/dir')
25 self.assertEqual(slic.optional_parameters(), [
'nevents',
'macros',
'run_number'])
29 self.assertEqual(slic.required_parameters(), [
'detector'])
33 self.assertEqual(slic.required_config(), [
'slic_dir',
'hps_fieldmaps_dir',
'detector_dir'])
37 self.assertRaises(Exception,
lambda: slic.cmd_args())
40 slic =
SLIC(inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
41 parser = configparser.ConfigParser()
42 config_file = [
'test_helpers/.hpsmc_test_cfg_invalid']
43 parser.read(config_file)
45 params = {
'detector':
'some_detector'}
46 slic.set_parameters(params)
47 self.assertRaises(Exception,
lambda: slic.cmd_args())
50 slic =
SLIC(inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
51 parser = configparser.ConfigParser()
52 config_file = [
'test_helpers/.hpsmc_test_cfg']
53 parser.read(config_file)
55 params = {
'detector':
'some_detector',
'nevents': 1}
56 slic.set_parameters(params)
57 self.assertEqual(slic.cmd_args(), [
"-g",
"some/detector/dir/some_detector/some_detector.lcdd",
"-i",
"some/path/to/input.slcio",
"-o",
"some/path/to/output.slcio",
"-d1",
"-r", str(1),
"-P",
"test_helpers/slicdir/share/particle.tbl"])
61 parser = configparser.ConfigParser()
62 config_file = [
'test_helpers/.hpsmc_test_cfg_invalid']
63 parser.read(config_file)
65 self.assertRaises(Exception,
lambda: slic.setup())
68 slic =
SLIC(inputs=[
"some/path/to/input.slcio"], outputs=[
"some/path/to/output.slcio"])
69 parser = configparser.ConfigParser()
70 config_file = [
'test_helpers/.hpsmc_test_cfg']
71 parser.read(config_file)
74 self.assertEqual(slic.env_script,
"test_helpers/slicdir/bin/slic-env.sh")
75 os.remove(os.getcwd() +
'/fieldmap')
78 if __name__ ==
'__main__':