def test_non_executable(self): f, name = tempfile.mkstemp() try: self.log('temp filename: %s', name) self.assertFalse(mergetools.check_availability(name)) finally: os.close(f) os.unlink(name)
def is_merge_tool_launchable(self): if mergetools is None: return False, gettext( "Bazaar 2.4 or later is required for external mergetools support" ) items = self.conflicts_list.selectedItems() error_msg = "" enabled = True if len(items) != 1 or items[0].data( 1, QtCore.Qt.UserRole).toString() != "text conflict": enabled = False config = GlobalConfig() tool = unicode(self.merge_tools_combo.currentText()) cmdline = config.find_merge_tool(tool) if cmdline is None: error_msg = gettext( "Set up external_merge app in qconfig under the Merge tab") enabled = False elif not mergetools.check_availability(cmdline): enabled = False error_msg = gettext("External merge tool %(tool)s is not available") % \ { 'tool': tool } return enabled, error_msg
def test_nonexistent(self): self.assertFalse(mergetools.check_availability('DOES NOT EXIST'))
def test_exe_on_path(self): self.assertTrue(mergetools.check_availability('python'))
def test_full_path(self): self.assertTrue(mergetools.check_availability(sys.executable))