Enable coverage info in Python2 projects. Py2 comp.

Thu, 10 Apr 2014 23:03:29 +0200

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Thu, 10 Apr 2014 23:03:29 +0200
branch
Py2 comp.
changeset 3496
b905cb8c520c
parent 3495
fac17a82b431
child 3505
84e7cee47d10

Enable coverage info in Python2 projects.

Project/Project.py file | annotate | diff | comparison | revisions
Project/ProjectSourcesBrowser.py file | annotate | diff | comparison | revisions
QScintilla/Editor.py file | annotate | diff | comparison | revisions
--- a/Project/Project.py	Thu Apr 10 23:02:20 2014 +0200
+++ b/Project/Project.py	Thu Apr 10 23:03:29 2014 +0200
@@ -4331,7 +4331,8 @@
             return
         
         files = [os.path.join(self.ppath, file)
-                 for file in self.pdata["SOURCES"] if file.endswith(".py")]
+                 for file in self.pdata["SOURCES"]
+                 if os.path.splitext(file)[1].startswith(".py")]
         from DataViews.PyCoverageDialog import PyCoverageDialog
         self.codecoverage = PyCoverageDialog()
         self.codecoverage.show()
@@ -4397,7 +4398,7 @@
                 os.path.isfile("{0}.profile".format(basename)) or
                 os.path.isfile("{0}.profile".format(tbasename)))
             self.codeCoverageAct.setEnabled(
-                self.isPy3Project() and
+                (self.isPy3Project() or self.isPy2Project()) and
                 (os.path.isfile("{0}.coverage".format(basename)) or
                  os.path.isfile("{0}.coverage".format(tbasename))))
         else:
--- a/Project/ProjectSourcesBrowser.py	Thu Apr 10 23:02:20 2014 +0200
+++ b/Project/ProjectSourcesBrowser.py	Thu Apr 10 23:03:29 2014 +0200
@@ -725,7 +725,7 @@
             coEnable = (coEnable or
                         os.path.isfile("{0}.coverage".format(basename)) or
                         os.path.isfile("{0}.coverage".format(tbasename))) and \
-                self.project.isPy3Project()
+                (self.project.isPy3Project() or self.project.isPy2Project())
         
         # now check the selected item
         itm = self.model().item(self.currentIndex())
@@ -736,7 +736,7 @@
                 os.path.isfile("{0}.profile".format(basename))
             coEnable = (coEnable or
                         os.path.isfile("{0}.coverage".format(basename))) and \
-                itm.isPython3File()
+                (itm.isPython3File() or itm.isPython2File())
         
         self.profileMenuAction.setEnabled(prEnable)
         self.coverageMenuAction.setEnabled(coEnable)
--- a/QScintilla/Editor.py	Thu Apr 10 23:02:20 2014 +0200
+++ b/QScintilla/Editor.py	Thu Apr 10 23:03:29 2014 +0200
@@ -4771,7 +4771,8 @@
                     coEnable or
                     os.path.isfile("{0}.coverage".format(basename)) or
                     os.path.isfile("{0}.coverage".format(tbasename))) and \
-                    self.project.isPy3Project()
+                    (self.project.isPy3Project() or
+                        self.project.isPy2Project())
         
         # now check ourself
         fn = self.getFileName()
@@ -4786,7 +4787,7 @@
                 coEnable or
                 os.path.isfile("{0}.coverage".format(basename)) or
                 os.path.isfile("{0}.coverage".format(tbasename))) and \
-                self.isPy3File()
+                self.isPyFile()
         
         # now check for syntax errors
         if self.hasSyntaxErrors():

eric ide

mercurial