21 from yapsy.PluginManager
import PluginManager
23 from ExecutorMTTTool
import *
35 ExecutorMTTTool.__init__(self)
37 self.
parser = configparser.ConfigParser()
38 self.parser.optionxform = str
47 IPlugin.activate(self)
51 IPlugin.deactivate(self)
55 return "Combinatorial executor"
58 lines = testDef.printOptions(self.
options)
68 tempSpecialSection = {}
70 writeOption = configparser.ConfigParser()
71 writeOption.optionxform = str
73 for section
in self.baseIniFile.sections():
76 if section.startswith(
"SKIP")
or section.startswith(
"skip"):
82 self.parser.add_section(section)
83 for option
in self.baseIniFile.options(section):
84 self.parser.set(section, option, self.baseIniFile.get(section, option))
86 fd, fileName = tempfile.mkstemp(suffix=
".ini", dir = self.
tempDir)
87 with open(fileName,
'w')
as configfile:
88 self.parser.write(configfile)
90 self.parser.remove_section(section)
91 if "MiddlewareGet" in section:
92 self.
runLog[section] = fileName
93 elif "TestRun" in section:
94 tempSpecialSection[section] = fileName
96 self.
iniLog[section] = fileName
99 for section
in self.
runLog:
100 self.parser.read(self.
runLog[section])
101 for id
in tempSpecialSection:
102 self.parser.read(tempSpecialSection[id])
103 fd, fileName = tempfile.mkstemp(suffix =
".ini", dir = self.
tempDir)
104 with open(fileName,
'w')
as configfile:
105 self.parser.write(configfile)
106 self.parser.remove_section(id)
107 tempList[fd] = fileName
108 self.parser.remove_section(section)
113 for section
in self.
iniLog:
114 writeOption.read(self.
iniLog[section])
115 for option
in writeOption.options(section):
116 if ',' in writeOption.get(section, option):
118 if optionsCSV[section]
is not None:
121 optionsCSV[section] = []
122 optionsCSV[section].append(option)
127 self.parser.read(self.
runLog[fd])
128 if not self.parser.has_section(section):
129 self.parser.add_section(section)
130 self.parser.set(section, option, writeOption.get(section, option))
132 with open(self.
runLog[fd],
'w')
as configfile:
133 self.parser.write(configfile)
135 for sect
in self.parser.sections():
136 self.parser.remove_section(sect)
137 writeOption.remove_section(section)
139 for section
in optionsCSV:
140 self.parser.read(self.
iniLog[section])
141 for option
in optionsCSV[section]:
143 rawList = self.parser.get(section, option)
144 splitList = rawList.split(
',')
146 for item
in splitList:
147 optionList.append(item.strip())
150 writeOption.read(self.
runLog[fd])
151 for nextOpt
in optionList:
153 if writeOption.has_section(section):
156 writeOption.add_section(section)
157 writeOption.set(section, option, nextOpt)
158 fd, fileName = tempfile.mkstemp(suffix=
".ini", dir = self.
tempDir)
159 with open(fileName,
'w')
as configfile:
160 writeOption.write(configfile)
161 newList[fd] = fileName
162 for sect
in writeOption.sections():
163 writeOption.remove_section(sect)
167 self.parser.remove_section(section)
170 testDef.logger.verbose_print(
"ExecuteCombinatorial")
175 print(
"Error, empty run log, combinatorial executor failed")
177 for nextFile
in self.
runLog:
178 if not os.path.isfile(self.
runLog[nextFile]):
179 print(
"Test .ini file not found!: " + nextFile)
181 testDef.configNewTest(self.
runLog[nextFile])
182 sequential_status = testDef.executeTest()
183 if sequential_status != 0: