5630 self.project.isOpen() and |
5630 self.project.isOpen() and |
5631 self.project.isProjectSource(self.fileName) |
5631 self.project.isProjectSource(self.fileName) |
5632 ): |
5632 ): |
5633 fn = self.project.getMainScript(True) |
5633 fn = self.project.getMainScript(True) |
5634 if fn is not None: |
5634 if fn is not None: |
5635 tfn = Utilities.getTestFileName(fn) |
5635 filenames = [os.path.splitext(f)[0] |
5636 basename = os.path.splitext(fn)[0] |
5636 for f in [fn] + Utilities.getTestFileNames(fn)] |
5637 tbasename = os.path.splitext(tfn)[0] |
5637 prEnable = any([ |
5638 prEnable = ( |
5638 os.path.isfile("{0}.profile".format(f)) |
5639 prEnable or |
5639 for f in filenames |
5640 os.path.isfile("{0}.profile".format(basename)) or |
5640 ]) |
5641 os.path.isfile("{0}.profile".format(tbasename)) |
|
5642 ) |
|
5643 coEnable = ( |
5641 coEnable = ( |
5644 (coEnable or |
5642 self.project.isPy3Project() and |
5645 os.path.isfile("{0}.coverage".format(basename)) or |
5643 any([ |
5646 os.path.isfile("{0}.coverage".format(tbasename))) and |
5644 os.path.isfile("{0}.coverage".format(f)) |
5647 self.project.isPy3Project() |
5645 for f in filenames |
|
5646 ]) |
5648 ) |
5647 ) |
5649 |
5648 |
5650 # now check ourselves |
5649 # now check ourselves |
5651 fn = self.getFileName() |
5650 fn = self.getFileName() |
5652 if fn is not None: |
5651 if fn is not None: |
5653 tfn = Utilities.getTestFileName(fn) |
5652 filenames = [os.path.splitext(f)[0] |
5654 basename = os.path.splitext(fn)[0] |
5653 for f in [fn] + Utilities.getTestFileNames(fn)] |
5655 tbasename = os.path.splitext(tfn)[0] |
5654 prEnable |= any([ |
5656 prEnable = ( |
5655 os.path.isfile("{0}.profile".format(f)) |
5657 prEnable or |
5656 for f in filenames |
5658 os.path.isfile("{0}.profile".format(basename)) or |
5657 ]) |
5659 os.path.isfile("{0}.profile".format(tbasename)) |
5658 coEnable |= ( |
5660 ) |
5659 self.project.isPy3Project() and |
5661 coEnable = ( |
5660 any([ |
5662 (coEnable or |
5661 os.path.isfile("{0}.coverage".format(f)) |
5663 os.path.isfile("{0}.coverage".format(basename)) or |
5662 for f in filenames |
5664 os.path.isfile("{0}.coverage".format(tbasename))) and |
5663 ]) |
5665 self.isPyFile() |
|
5666 ) |
5664 ) |
5667 |
5665 |
5668 coEnable |= bool(self.__coverageFile) |
5666 coEnable |= bool(self.__coverageFile) |
5669 |
5667 |
5670 # now check for syntax errors |
5668 # now check for syntax errors |
6067 self.project.isOpen() and |
6065 self.project.isOpen() and |
6068 self.project.isProjectSource(self.fileName) |
6066 self.project.isProjectSource(self.fileName) |
6069 ): |
6067 ): |
6070 fn = self.project.getMainScript(True) |
6068 fn = self.project.getMainScript(True) |
6071 if fn is not None: |
6069 if fn is not None: |
6072 tfn = Utilities.getTestFileName(fn) |
6070 for filename in [fn] + Utilities.getTestFileNames(fn): |
6073 basename = os.path.splitext(fn)[0] |
6071 basename = os.path.splitext(filename)[0] |
6074 tbasename = os.path.splitext(tfn)[0] |
6072 f = "{0}.coverage".format(basename) |
6075 |
6073 if os.path.isfile(f): |
6076 f = "{0}.coverage".format(basename) |
6074 files.append(f) |
6077 tf = "{0}.coverage".format(tbasename) |
|
6078 if os.path.isfile(f): |
|
6079 files.append(f) |
|
6080 if os.path.isfile(tf): |
|
6081 files.append(tf) |
|
6082 |
6075 |
6083 # now check, if there are coverage files belonging to ourselves |
6076 # now check, if there are coverage files belonging to ourselves |
6084 fn = self.getFileName() |
6077 fn = self.getFileName() |
6085 if fn is not None: |
6078 if fn is not None: |
6086 tfn = Utilities.getTestFileName(fn) |
6079 for filename in [fn] + Utilities.getTestFileNames(fn): |
6087 basename = os.path.splitext(fn)[0] |
6080 basename = os.path.splitext(filename)[0] |
6088 tbasename = os.path.splitext(tfn)[0] |
6081 f = "{0}.coverage".format(basename) |
6089 |
6082 if os.path.isfile(f): |
6090 f = "{0}.coverage".format(basename) |
6083 files.append(f) |
6091 tf = "{0}.coverage".format(tbasename) |
6084 |
6092 if os.path.isfile(f) and f not in files: |
6085 # make the list unique |
6093 files.append(f) |
6086 files = list(set(files)) |
6094 if os.path.isfile(tf) and tf not in files: |
|
6095 files.append(tf) |
|
6096 |
6087 |
6097 if files: |
6088 if files: |
6098 if len(files) > 1: |
6089 if len(files) > 1: |
6099 fn, ok = QInputDialog.getItem( |
6090 fn, ok = QInputDialog.getItem( |
6100 self, |
6091 self, |
6259 self.project.isOpen() and |
6250 self.project.isOpen() and |
6260 self.project.isProjectSource(self.fileName) |
6251 self.project.isProjectSource(self.fileName) |
6261 ): |
6252 ): |
6262 fn = self.project.getMainScript(True) |
6253 fn = self.project.getMainScript(True) |
6263 if fn is not None: |
6254 if fn is not None: |
6264 tfn = Utilities.getTestFileName(fn) |
6255 for filename in [fn] + Utilities.getTestFileNames(fn): |
6265 basename = os.path.splitext(fn)[0] |
6256 basename = os.path.splitext(filename)[0] |
6266 tbasename = os.path.splitext(tfn)[0] |
6257 f = "{0}.profile".format(basename) |
6267 |
6258 if os.path.isfile(f): |
6268 f = "{0}.profile".format(basename) |
6259 files.append(f) |
6269 tf = "{0}.profile".format(tbasename) |
|
6270 if os.path.isfile(f): |
|
6271 files.append(f) |
|
6272 if os.path.isfile(tf): |
|
6273 files.append(tf) |
|
6274 |
6260 |
6275 # now check, if there are profile files belonging to ourselves |
6261 # now check, if there are profile files belonging to ourselves |
6276 fn = self.getFileName() |
6262 fn = self.getFileName() |
6277 if fn is not None: |
6263 if fn is not None: |
6278 tfn = Utilities.getTestFileName(fn) |
6264 for filename in [fn] + Utilities.getTestFileNames(fn): |
6279 basename = os.path.splitext(fn)[0] |
6265 basename = os.path.splitext(filename)[0] |
6280 tbasename = os.path.splitext(tfn)[0] |
6266 f = "{0}.profile".format(basename) |
6281 |
6267 if os.path.isfile(f): |
6282 f = "{0}.profile".format(basename) |
6268 files.append(f) |
6283 tf = "{0}.profile".format(tbasename) |
6269 |
6284 if os.path.isfile(f) and f not in files: |
6270 # make the list unique |
6285 files.append(f) |
6271 files = list(set(files)) |
6286 if os.path.isfile(tf) and tf not in files: |
|
6287 files.append(tf) |
|
6288 |
6272 |
6289 if files: |
6273 if files: |
6290 if len(files) > 1: |
6274 if len(files) > 1: |
6291 fn, ok = QInputDialog.getItem( |
6275 fn, ok = QInputDialog.getItem( |
6292 self, |
6276 self, |