def run(self): self.res_fname = "result.txt" test_num = 1 comment = "Test utilities.get_util_path with custom path \n" self.results.append(_BASE_COMMENT % test_num + comment) self.results.append("-----\n") self.results.append("Custom util path: %s\n" % self.tmp_dir) new_util_path = utils.get_util_path(self.tmp_dir) self.results.append("returned path from get_util_path: %s\n" % new_util_path) if not new_util_path == self.tmp_dir: raise MUTLibError("get_util_path fails to get expected path") self.results.append("Test Pass \n") self.results.append("\n") test_num += 1 comment = "Show help utilities with custom utildir" cmd_str = '%s/mysqluc.py --width=77' % self.utildir cmd_str += ' --utildir=%s' % self.tmp_dir + ' -e "%s"' cmd = "help utilities" self.do_test(test_num, comment, cmd_str % cmd) test_num += 1 comment = "Execute an utility --help on a custom utildir" cmd = self.util_test + " --help" return self.do_test(test_num, comment, cmd_str % cmd)
def run(self): self.res_fname = "result.txt" test_num = 1 comment = "Test utilities.get_util_path with custom path \n" self.results.append(_BASE_COMMENT.format(test_num) + comment) self.results.append("-----\n") self.results.append("Custom util path: {0}\n".format(self.tmp_dir)) new_util_path = utils.get_util_path(self.tmp_dir) self.results.append( "returned path from get_util_path: {0}\n".format(new_util_path)) if not new_util_path == self.tmp_dir: raise MUTLibError("get_util_path fails to get expected path") self.results.append("Test Pass \n") self.results.append("\n") test_num += 1 comment = "Show help utilities with custom utildir" cmd_str = 'mysqluc.py --width=77 --utildir={0} {1} '.format( self.tmp_dir, '--execute="{0}"') cmd = "help utilities" self.do_test(test_num, comment, cmd_str.format(cmd)) test_num += 1 comment = "Execute an utility --help on a custom utildir" cmd = self.util_test + " --help; help utilities" self.do_test(test_num, comment, cmd_str.format(cmd)) # pylint: disable=W1401 self.replace_substring("tmp_scripts\mysql", "tmp_scripts/mysql") return True
def __init__(self, options={}): """Constructor options[in] Array of options for controlling what is included and how operations perform (e.g., verbose) """ Console.__init__(self, _NEW_BASE_COMMANDS, options) try: from mysql.utilities.common.utilities import get_util_path path = get_util_path(options.get("utildir", "")) if path is None: raise except: raise UtilError(_UTILS_MISSING) self.utils = Utilities(options) if self.quiet: self.f_out = tempfile.NamedTemporaryFile(delete=False) print "Quiet mode, saving output to %s" % self.f_out.name else: self.f_out = None
def __init__(self, options=None): """Constructor options[in] Array of options for controlling what is included and how operations perform (e.g., verbose) """ if options is None: options = {} Console.__init__(self, _NEW_BASE_COMMANDS, options) try: self.path = get_util_path(options.get("utildir", "")) if self.path is None: raise except: raise UtilError(_UTILS_MISSING) self.utils = Utilities(options) self.errors = [] if self.quiet: self.f_out = tempfile.NamedTemporaryFile(delete=False) print("Quiet mode, saving output to {0}".format(self.f_out.name)) else: self.f_out = None