#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import re import sys import glob import helper from mockable_test_result import MockableTestResult from runner import path_to_enlightenment from libs.colorama import init, Fore, Style init() # init colorama class Sensei(MockableTestResult): def __init__(self, stream): unittest.TestResult.__init__(self) self.stream = stream self.prevTestClassName = None self.tests = path_to_enlightenment.koans() self.pass_count = 0 self.lesson_pass_count = 0 self.all_lessons = None def startTest(self, test): MockableTestResult.startTest(self, test) if helper.cls_name(test) != self.prevTestClassName: self.prevTestClassName = helper.cls_name(test) if not self.failures:
from toolbox.classes.keys import Keys from toolbox.classes.build import Build from libs.colorama import init, Fore, Back, Style init() global Menu class Menu(): def main(self, argv): print("Keys.file_present : " + self.color_boolean(Keys.file_present)) print("Keys.is_valid : " + self.color_boolean(Keys.is_valid)) print("Build.git_present : " + self.color_boolean(Build.git_present)) print("Build.devkitPro_present : " + self.color_boolean(Build.devkitPro_present)) print("Build.libnx_valid : " + self.color_boolean(Build.libnx_valid)) print('') if len(argv) > 1: if argv[1] == "build": Build.build_atmosphere() def color_boolean(self, boolean): if boolean is True: return Fore.GREEN + str(boolean) + Style.RESET_ALL elif boolean is False: return Fore.RED + str(boolean) + Style.RESET_ALL return Fore.ORANGE + str(boolean) + Style.RESET_ALL Menu = Menu()
#!/usr/bin/env python # -*- coding: utf-8 -*- import unittest import re import sys import os import glob import helper from mockable_test_result import MockableTestResult from runner import path_to_enlightenment from libs.colorama import init, Fore, Style init() # init colorama class Sensei(MockableTestResult): def __init__(self, stream): unittest.TestResult.__init__(self) self.stream = stream self.prevTestClassName = None self.tests = path_to_enlightenment.koans() self.pass_count = 0 self.lesson_pass_count = 0 self.all_lessons = None def startTest(self, test): MockableTestResult.startTest(self, test) if helper.cls_name(test) != self.prevTestClassName:
def print_color(msg, mark = 0, record = False): if mark == 0: msg = Fore.RED + '[-] %s' % msg elif mark == 1: msg = Fore.GREEN + '[+] %s' % msg elif mark == 2: msg = Fore.YELLOW + '[*] %s' % msg sys.stdout.write(msg + Fore.RESET + Back.RESET + Style.RESET_ALL + '\n') def runtime(): return time.time() def query_yes_no(question, default="no"): valid = {"y":True,"n":False} while True: sys.stdout.write(Fore.YELLOW + question + ' [y/N] ' + Fore.RESET + Back.RESET + Style.RESET_ALL) choice = raw_input().lower() if default is not None and choice == '': return valid[default] elif choice in valid: return valid[choice] else: sys.stdout.write(Fore.YELLOW + "please respond with 'y' or 'n'.\n" + Fore.RESET + Back.RESET + Style.RESET_ALL) init() # 记录日志 logging.basicConfig(filename = os.path.join(os.getcwd()+'/output', 'debug.log'), level = logging.DEBUG)