def test_daily_rewards(dev, poco): out('Daily Rewards test started...') f_ret = False t0 = time.time() state = find_current_state(poco) if state == State.MAP: f_ret = run_test_daily_rewards(dev, poco) out('Daily Rewards test time: ' + str(time.time() - t0)) if not f_ret: out('last snapshot') snapshot() return f_ret
def test_tutorial_8(dev, poco): out('Tutorial_8 test started...') f_ret = False t0 = time.time(); state = find_current_state(poco) if state == State.MAP: f_ret = run_test(dev, poco) out('Tutorial_8 test time: ' + str(time.time() - t0)) if not f_ret: out('last snapshot') snapshot() return f_ret
def test_tutorial_0(dev, poco): out('Tutorial_0 test started...') f_ret = False t0 = time.time() state = find_current_state(poco) if state == State.MAP: if reset_progress(dev, poco): f_ret = run_test_tutorial(dev, poco) else: if state == State.TUTORIAL: f_ret = run_test_tutorial(dev, poco) out("Tutorial_0 test time: " + str(time.time() - t0)) if not f_ret: out('last snapshot') snapshot() if not f_ret: skip_tutorial_0(dev, poco) return f_ret
def run(self, times=None): if times: self.run_times = times if not self.run_times: self.run_times = int(input("input times\n")) self.now_times = 0 try: for i in range(0, self.run_times): self.step() self.now_times = i + 1 print( str.format( "第%d次,剩余%d次" % (self.now_times, self.run_times - self.now_times))) print( str.format( "第%d次,剩余%d次" % (self.now_times, self.run_times - self.now_times))) except Exception as e: f = open(self.TRACE_PATH, 'w', encoding="UTF-8") traceback.print_exc(None, f, True) localtime = time.asctime(time.localtime(time.time())) f.write(localtime.__str__() + "\n") f.flush() f.close() if self.context.debug: os.system("start " + self.TRACE_PATH) # print(traceback.format_exc()) traceback.print_exc() except KeyboardInterrupt as interrupt: if self.context.debug: os.system("start " + self.TRACE_PATH) finally: print( str.format("第%d次未完整完成,剩余%d次" % (self.now_times, self.run_times - self.now_times))) simple_report(self.filePath(), logpath=True)