PyUnit/UnittestDialog.py

changeset 6892
c147620313c5
parent 6890
26c1042f2eec
child 6893
d29a7b8fab0f
--- a/PyUnit/UnittestDialog.py	Thu Mar 21 19:27:42 2019 +0100
+++ b/PyUnit/UnittestDialog.py	Fri Mar 22 19:11:11 2019 +0100
@@ -105,8 +105,6 @@
         self.setWindowTitle(self.tr("Unittest"))
         if dbs:
             self.ui = ui
-        else:
-            self.localCheckBox.hide()
         self.__setProgressColor("green")
         self.progressLed.setDarkFactor(150)
         self.progressLed.off()
@@ -236,31 +234,6 @@
         """
         self.insertProg(suite)
         
-    @pyqtSlot(str)
-    def on_testsuitePicker_editTextChanged(self, txt):
-        """
-        Private slot to handle changes of the test file name.
-        
-        @param txt name of the test file (string)
-        """
-        fileTypes = {
-            "Python2": ("Python", "Python2"),
-            "Python3": ("Python3", )
-        }
-        if self.__dbs:
-            ver = sys.version_info[0]
-            variant = "Python{0}".format(ver)
-            exts = self.__dbs.getExtensions(variant)
-            flags = Utilities.extractFlagsFromFile(txt)
-            if not txt.endswith(exts) or \
-               ("FileType" in flags and
-                    flags["FileType"] not in fileTypes[variant]):
-                self.localCheckBox.setChecked(False)
-                self.localCheckBox.setEnabled(False)
-                return
-        
-        self.localCheckBox.setEnabled(bool(self.__dbs))
-        
     def on_buttonBox_clicked(self, button):
         """
         Private slot called by a button of the button box clicked.
@@ -306,15 +279,17 @@
         # build the module name from the filename without extension
         self.testName = os.path.splitext(os.path.basename(prog))[0]
         
-        if self.__dbs and not self.localCheckBox.isChecked():
+        if self.__dbs:
             # we are cooperating with the eric6 IDE
             project = e5App().getObject("Project")
             if self.__forProject and project.isOpen() and \
                project.isProjectSource(prog):
-                mainScript = project.getMainScript(True)
+                mainScript = os.path.abspath(project.getMainScript(True))
                 clientType = project.getProjectLanguage()
+                sysPath = [os.path.dirname(mainScript)]
             else:
                 mainScript = os.path.abspath(prog)
+                sysPath = []
                 flags = Utilities.extractFlagsFromFile(mainScript)
                 if mainScript.endswith(
                     tuple(Preferences.getPython("PythonExtensions"))) or \
@@ -334,9 +309,9 @@
                 self.coverageCheckBox.isChecked(), mainScript,
                 self.coverageEraseCheckBox.isChecked(), clientType=clientType,
                 forProject=self.__forProject,
-                venvName=self.venvComboBox.currentText())
+                venvName=self.venvComboBox.currentText(), syspath=sysPath)
         else:
-            # we are running as an application or in local mode
+            # we are running as an application
             sys.path = [os.path.dirname(os.path.abspath(prog))] + \
                 self.savedSysPath
             
@@ -440,7 +415,7 @@
         """
         Private slot to stop the test.
         """
-        if self.__dbs and not self.localCheckBox.isChecked():
+        if self.__dbs:
             self.__dbs.remoteUTStop()
         elif self.testResult:
             self.testResult.stop()
@@ -613,7 +588,7 @@
         if doc:
             self.testsListWidget.insertItem(0, "    {0}".format(doc))
         self.testsListWidget.insertItem(0, test)
-        if self.__dbs is None or self.localCheckBox.isChecked():
+        if self.__dbs is None:
             QApplication.processEvents()
         
     def testFinished(self):
@@ -736,20 +711,6 @@
             except Exception:
                 # ignore all exceptions
                 pass
-    
-    @pyqtSlot(str)
-    def on_venvComboBox_currentTextChanged(self, venvName):
-        """
-        Private slot to handle the selection of a virtual environment.
-        
-        @param venvName name of the selected virtual environment
-        @type str
-        """
-        if venvName:
-            self.localCheckBox.setChecked(False)
-            self.localCheckBox.setEnabled(False)
-        else:
-            self.localCheckBox.setEnabled(True)
 
 
 class QtTestResult(unittest.TestResult):

eric ide

mercurial