Ejemplo n.º 1
0
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)
Ejemplo n.º 2
0
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)
Ejemplo n.º 3
0
            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)