113 @return list of process arguments |
113 @return list of process arguments |
114 @rtype list of str |
114 @rtype list of str |
115 """ |
115 """ |
116 args = [ |
116 args = [ |
117 UnittestExecutor.runner, |
117 UnittestExecutor.runner, |
118 "runtest", |
118 "discovery" if config.discoverOnly else "runtest", |
119 self.reader.address(), |
119 self.reader.address(), |
120 str(self.reader.port()), |
120 str(self.reader.port()), |
121 ] |
121 ] |
122 |
122 |
123 if config.discover: |
123 if config.discover: |
147 if config.failedOnly: |
147 if config.failedOnly: |
148 args.append("--failed-only") |
148 args.append("--failed-only") |
149 if config.testFilename: |
149 if config.testFilename: |
150 args.append(config.testFilename) |
150 args.append(config.testFilename) |
151 args.extend(self.__testWidget.getFailedTests()) |
151 args.extend(self.__testWidget.getFailedTests()) |
|
152 elif config.testCases: |
|
153 args.extend(config.testCases) |
152 elif config.testFilename: |
154 elif config.testFilename: |
153 args.append(config.testFilename) |
155 args.append(config.testFilename) |
154 args.append(config.testName if config.testName else "@NONE@") |
156 args.append(config.testName if config.testName else "@NONE@") |
155 # @NONE@ is just a marker for no test name given |
157 # @NONE@ is just a marker for no test name given |
156 |
158 |
157 return args |
159 return args |
158 |
160 |
|
161 def discover(self, config, pythonpath): |
|
162 """ |
|
163 Public method to start the test discovery process. |
|
164 |
|
165 @param config configuration for the test discovery |
|
166 @type TestConfig |
|
167 @param pythonpath list of directories to be added to the Python path |
|
168 @type list of str |
|
169 """ |
|
170 self.reader = EricJsonReader(name="Unittest Reader", parent=self) |
|
171 self.reader.dataReceived.connect(self.__processData) |
|
172 |
|
173 super().discover(config, pythonpath) |
|
174 |
159 def start(self, config, pythonpath): |
175 def start(self, config, pythonpath): |
160 """ |
176 """ |
161 Public method to start the testing process. |
177 Public method to start the testing process. |
162 |
178 |
163 @param config configuration for the test execution |
179 @param config configuration for the test execution |
195 self.collectError.emit([("", data["error"])]) |
211 self.collectError.emit([("", data["error"])]) |
196 |
212 |
197 # tests collected |
213 # tests collected |
198 elif data["event"] == "collected": |
214 elif data["event"] == "collected": |
199 self.collected.emit( |
215 self.collected.emit( |
200 [(t["id"], t["name"], t["description"], "", 0) for t in data["tests"]] |
216 [ |
|
217 ( |
|
218 t["id"], |
|
219 t["name"], |
|
220 t["description"], |
|
221 t["filename"], |
|
222 0, |
|
223 t["id"].split("."), |
|
224 ) |
|
225 for t in data["tests"] |
|
226 ] |
201 ) |
227 ) |
202 |
228 |
203 # test started |
229 # test started |
204 elif data["event"] == "started": |
230 elif data["event"] == "started": |
205 self.startTest.emit((data["id"], data["name"], data["description"])) |
231 self.startTest.emit((data["id"], data["name"], data["description"])) |