17 |
17 |
18 from .Ui_PyCoverageDialog import Ui_PyCoverageDialog |
18 from .Ui_PyCoverageDialog import Ui_PyCoverageDialog |
19 |
19 |
20 import Utilities |
20 import Utilities |
21 from DebugClients.Python3.coverage import coverage |
21 from DebugClients.Python3.coverage import coverage |
|
22 from DebugClients.Python3.coverage.misc import CoverageException |
22 |
23 |
23 |
24 |
24 class PyCoverageDialog(QDialog, Ui_PyCoverageDialog): |
25 class PyCoverageDialog(QDialog, Ui_PyCoverageDialog): |
25 """ |
26 """ |
26 Class implementing a dialog to display the collected code coverage data. |
27 Class implementing a dialog to display the collected code coverage data. |
182 # now go through all the files |
183 # now go through all the files |
183 for file in files: |
184 for file in files: |
184 if self.cancelled: |
185 if self.cancelled: |
185 return |
186 return |
186 |
187 |
187 statements, excluded, missing, readable = cover.analysis2(file)[1:] |
188 try: |
188 readableEx = excluded and self.__format_lines(excluded) or '' |
189 statements, excluded, missing, readable = cover.analysis2(file)[1:] |
189 n = len(statements) |
190 readableEx = excluded and self.__format_lines(excluded) or '' |
190 m = n - len(missing) |
191 n = len(statements) |
191 if n > 0: |
192 m = n - len(missing) |
192 pc = 100.0 * m / n |
193 if n > 0: |
193 else: |
194 pc = 100.0 * m / n |
194 pc = 100.0 |
195 else: |
195 self.__createResultItem(file, str(n), str(m), pc, readableEx, readable) |
196 pc = 100.0 |
196 |
197 self.__createResultItem(file, str(n), str(m), pc, readableEx, |
197 total_statements = total_statements + n |
198 readable) |
198 total_executed = total_executed + m |
199 |
|
200 total_statements = total_statements + n |
|
201 total_executed = total_executed + m |
|
202 except CoverageException: |
|
203 # ignore silently (will be changed in eric5 5.4) |
|
204 pass |
199 |
205 |
200 progress += 1 |
206 progress += 1 |
201 self.checkProgress.setValue(progress) |
207 self.checkProgress.setValue(progress) |
202 QApplication.processEvents() |
208 QApplication.processEvents() |
203 finally: |
209 finally: |