def upgrade(): """ 修改本系统 EventDocument 中的数据 添加 role 字段,表示记录事件的统计员是主力还是替补 :return: """ total = 0 fails = [] for event in conn.EventDocument.find(): total += 1 try: __upgrade_event(event) except: fails.append(event) print event print traceback.format_exc() print_summary(__file__, total, fails)
def upgrade_by_stat(): total = 0 fails = [] for statistician in conn.StatisticianMatchesDocument.find(): total += 1 try: for event in conn.EventDocument.find({ "statistician_id": statistician.get("statistician_id"), "match_id": statistician.get("match_id"), "team_id": statistician.get("team_id"), }): event['role'] = statistician.get("role") event.save() except: fails.append(statistician) print statistician print traceback.format_exc() print_summary(__file__, total, fails)
base.tests_fail += fails print(s) base.summary.append(s) try: i = sys.argv.index('--thirdparty') thirdparty = True sys.argv = sys.argv[:i] + sys.argv[i + 1:] except ValueError: thirdparty = False test_files = base.get_test_list() # completion tests: completion_test_dir = '../test/completion' # execute tests test_dir(completion_test_dir) if test_files or thirdparty: completion_test_dir += '/thirdparty' test_dir(completion_test_dir, thirdparty=True) base.print_summary() exit_code = 1 if base.tests_fail else 0 if sys.hexversion < 0x02060000 and base.tests_fail <= 9: # Python 2.5 has major incompabillities (e.g. no property.setter), # therefore it is not possible to pass all tests. exit_code = 0 sys.exit(exit_code)