154 if self.dbs: |
154 if self.dbs: |
155 pyExtensions = \ |
155 pyExtensions = \ |
156 ' '.join(["*%s" % ext for ext in self.dbs.getExtensions('Python')]) |
156 ' '.join(["*%s" % ext for ext in self.dbs.getExtensions('Python')]) |
157 py3Extensions = \ |
157 py3Extensions = \ |
158 ' '.join(["*%s" % ext for ext in self.dbs.getExtensions('Python3')]) |
158 ' '.join(["*%s" % ext for ext in self.dbs.getExtensions('Python3')]) |
159 filter = self.trUtf8("Python Files ({0});;Python3 Files ({1});;All Files (*)")\ |
159 filter = self.trUtf8("Python3 Files ({1});;Python2 Files ({0});;All Files (*)")\ |
160 .format(pyExtensions, py3Extensions) |
160 .format(pyExtensions, py3Extensions) |
161 else: |
161 else: |
162 filter = self.trUtf8("Python Files (*.py);;All Files (*)") |
162 filter = self.trUtf8("Python Files (*.py);;All Files (*)") |
163 prog = QFileDialog.getOpenFileName(\ |
163 prog = QFileDialog.getOpenFileName(\ |
164 self, |
164 self, |
177 Private slot to handle changes of the test file name. |
177 Private slot to handle changes of the test file name. |
178 |
178 |
179 @param txt name of the test file (string) |
179 @param txt name of the test file (string) |
180 """ |
180 """ |
181 if self.dbs: |
181 if self.dbs: |
182 exts = self.dbs.getExtensions("Python3") |
182 exts = self.dbs.getExtensions("Python") |
183 if txt.endswith(exts): |
183 if txt.endswith(exts): |
184 self.coverageCheckBox.setChecked(False) |
184 self.coverageCheckBox.setChecked(False) |
185 self.coverageCheckBox.setEnabled(False) |
185 self.coverageCheckBox.setEnabled(False) |
186 self.localCheckBox.setChecked(False) |
186 self.localCheckBox.setChecked(False) |
187 self.localCheckBox.setEnabled(False) |
187 self.localCheckBox.setEnabled(False) |
240 # we are running as an application or in local mode |
240 # we are running as an application or in local mode |
241 sys.path = [os.path.dirname(os.path.abspath(prog))] + self.savedSysPath |
241 sys.path = [os.path.dirname(os.path.abspath(prog))] + self.savedSysPath |
242 |
242 |
243 # clean up list of imported modules to force a reimport upon running the test |
243 # clean up list of imported modules to force a reimport upon running the test |
244 if self.savedModulelist: |
244 if self.savedModulelist: |
245 for modname in sys.modules: |
245 for modname in list(sys.modules.keys()): |
246 if modname not in self.savedModulelist: |
246 if modname not in self.savedModulelist: |
247 # delete it |
247 # delete it |
248 del(sys.modules[modname]) |
248 del(sys.modules[modname]) |
249 self.savedModulelist = sys.modules.copy() |
249 self.savedModulelist = sys.modules.copy() |
250 |
250 |