Пример #1
0
 def display_test_result(self):
     if self.passed is True:
         result = terminal.colortext('[PASSED]', Fore.GREEN)
     else:
         result = terminal.colortext('[FAILED]', Fore.RED)
     terminal.render_hline(Fore.YELLOW)
     print(terminal.colortext(self.result_str(), Fore.BLUE))
     width = terminal.get_terminal_width()
     print("{0:<" + str(width - 10) + "} {1:>9}".format(
         terminal.colortext(self.desc or 'None', Fore.YELLOW), result))
     print(self.title)
     print(repr(self))
Пример #2
0
 def display_test_suite_result(self):
     width = terminal.get_terminal_width()
     terminal.render_hline(Fore.CYAN)
     if self.passed is True:
         result = terminal.colortext('[PASSED]', Fore.GREEN)
     else:
         result = terminal.colortext('[FAILED]', Fore.RED)
     fstring = "{0:<" + str(width - 10) + "} {1:>9}"
     print(
         fstring.format(terminal.colortext(self.desc or 'None', Fore.CYAN),
                        result))
     print(terminal.colortext(repr(self), Fore.CYAN))
     terminal.render_hline(Fore.CYAN)
Пример #3
0
 def display_test_result(self):
     if self.passed is True:
         result = terminal.colortext('[PASSED]', Fore.GREEN)
     else:
         result = terminal.colortext('[FAILED]', Fore.RED)
     terminal.render_hline(Fore.YELLOW)
     print(terminal.colortext(self.result_str(), Fore.BLUE))
     width = terminal.get_terminal_width()
     hline = '-' * width
     print(terminal.colortext(hline, Fore.YELLOW))
     fstring = "{0}{1:<" + str(width - 10) + "}{2} {3:>9}"
     print(terminal.colortext(self.result_str(), Fore.BLUE))
     print(
         fstring.format(Fore.YELLOW, (self.desc or 'None'), Fore.WHITE,
                        result))
     print(self.title)
     print(repr(self))
Пример #4
0
 def do_test(self):
     logger.debug("Running Test Suite : " + repr(self))
     try:
         for prep in self._prep:
             prep.run_prep()
         for test in self._tests:
             test.run_test()
         self.display_test_suite_result()
     except KeyboardInterrupt:
         print(terminal.colortext("Aborted by user!", Fore.RED))
Пример #5
0
def user_prompt_yesno(string):
    ans = None
    while ans is None:
        user_input = input(
            terminal.colortext("{0} [y/n]".format(string), Fore.YELLOW))
        if user_input == 'N' or user_input == 'n':
            ans = False
        elif user_input == 'Y' or user_input == 'y':
            ans = True
    return ans
Пример #6
0
    def do_test(self):
        self.skipped = True
        try:
            logger.debug("Running Test : " + repr(self))

            if self._offline is True:
                raise IOError("Cannot run an offline test")

            for prep in self._prep:
                prep.run_prep()

            self.do_measurements()

            self.ts = arrow.utcnow()
            self.display_test_result()
            self.skipped = False

        except KeyboardInterrupt:
            print(terminal.colortext("Aborted by user!", Fore.RED))
Пример #7
0
 def run_prep(self):
     terminal.render_hline()
     print(terminal.colortext(self._string, Fore.YELLOW))
     input(terminal.colortext("Press Enter to continue...", Fore.YELLOW))
Пример #8
0
 def run_test(self):
     try:
         repeatable_runtest(self.do_test, "Repeat test suite?")
     except KeyboardInterrupt:
         print(terminal.colortext("Aborted by user!", Fore.RED))