2010-08-30 17:24:28 +02:00
|
|
|
#!/usr/bin/env python
|
2010-08-23 07:28:30 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
2010-08-30 17:24:28 +02:00
|
|
|
#
|
2011-03-10 06:16:31 +01:00
|
|
|
# Copyright 2010-2011, Carl Gherardi
|
2010-08-30 17:24:28 +02:00
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
|
|
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
########################################################################
|
|
|
|
|
2010-08-19 12:30:12 +02:00
|
|
|
import sys
|
|
|
|
import os
|
|
|
|
import codecs
|
|
|
|
from Hand import *
|
|
|
|
import Configuration
|
|
|
|
import Database
|
|
|
|
import SQL
|
|
|
|
import fpdb_import
|
2010-12-10 11:21:21 +01:00
|
|
|
import Options
|
2010-12-10 16:59:27 +01:00
|
|
|
import datetime
|
|
|
|
import pytz
|
2011-03-30 07:29:39 +02:00
|
|
|
import pprint
|
|
|
|
pp = pprint.PrettyPrinter(indent=4)
|
2010-08-19 12:30:12 +02:00
|
|
|
|
2011-03-30 05:13:03 +02:00
|
|
|
DEBUG = False
|
|
|
|
|
2010-08-19 12:30:12 +02:00
|
|
|
|
2010-08-24 05:09:13 +02:00
|
|
|
class FpdbError:
|
2010-08-28 10:43:05 +02:00
|
|
|
def __init__(self, sitename):
|
|
|
|
self.site = sitename
|
2010-08-24 05:09:13 +02:00
|
|
|
self.errorcount = 0
|
2010-08-24 05:55:30 +02:00
|
|
|
self.histogram = {}
|
2010-09-04 07:11:35 +02:00
|
|
|
self.statcount = {}
|
2010-08-24 05:09:13 +02:00
|
|
|
|
|
|
|
def error_report(self, filename, hand, stat, ghash, testhash, player):
|
|
|
|
print "Regression Test Error:"
|
|
|
|
print "\tFile: %s" % filename
|
|
|
|
print "\tStat: %s" % stat
|
|
|
|
print "\tPlayer: %s" % player
|
2010-08-24 05:55:30 +02:00
|
|
|
if filename in self.histogram:
|
|
|
|
self.histogram[filename] += 1
|
|
|
|
else:
|
|
|
|
self.histogram[filename] = 1
|
2010-09-04 07:11:35 +02:00
|
|
|
|
|
|
|
if stat in self.statcount:
|
|
|
|
self.statcount[stat] += 1
|
|
|
|
else:
|
|
|
|
self.statcount[stat] = 1
|
2010-08-24 05:09:13 +02:00
|
|
|
self.errorcount += 1
|
|
|
|
|
2010-08-24 05:55:30 +02:00
|
|
|
def print_histogram(self):
|
2010-08-28 10:43:05 +02:00
|
|
|
print "%s:" % self.site
|
2010-08-24 05:55:30 +02:00
|
|
|
for f in self.histogram:
|
|
|
|
idx = f.find('regression')
|
|
|
|
print "(%3d) : %s" %(self.histogram[f], f[idx:])
|
|
|
|
|
2011-01-13 07:32:13 +01:00
|
|
|
def compare_gametypes_file(filename, importer, errors):
|
|
|
|
hashfilename = filename + '.gt'
|
|
|
|
|
|
|
|
in_fh = codecs.open(hashfilename, 'r', 'utf8')
|
|
|
|
whole_file = in_fh.read()
|
|
|
|
in_fh.close()
|
|
|
|
|
|
|
|
testhash = eval(whole_file)
|
|
|
|
|
|
|
|
hhc = importer.getCachedHHC()
|
|
|
|
handlist = hhc.getProcessedHands()
|
|
|
|
|
|
|
|
lookup = {
|
|
|
|
0:'siteId',
|
|
|
|
1:'currency',
|
|
|
|
2:'type',
|
|
|
|
3:'base',
|
|
|
|
4:'game',
|
|
|
|
5:'limit',
|
|
|
|
6:'hilo',
|
|
|
|
7:'Small Blind',
|
|
|
|
8:'Big Blind',
|
|
|
|
9:'Small Bet',
|
|
|
|
10:'Big Bet',
|
|
|
|
}
|
|
|
|
|
|
|
|
for hand in handlist:
|
|
|
|
ghash = hand.gametyperow
|
|
|
|
for i in range(len(ghash)):
|
2011-02-21 07:08:53 +01:00
|
|
|
#print "DEBUG: about to compare: '%s' and '%s'" %(ghash[i], testhash[i])
|
2011-01-13 07:32:13 +01:00
|
|
|
if ghash[i] == testhash[i]:
|
|
|
|
# The stats match - continue
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
errors.error_report(filename, hand, lookup[i], ghash, testhash, None)
|
|
|
|
pass
|
|
|
|
|
2010-12-10 16:59:27 +01:00
|
|
|
def compare_handsplayers_file(filename, importer, errors):
|
|
|
|
hashfilename = filename + '.hp'
|
|
|
|
|
|
|
|
in_fh = codecs.open(hashfilename, 'r', 'utf8')
|
|
|
|
whole_file = in_fh.read()
|
|
|
|
in_fh.close()
|
|
|
|
|
|
|
|
testhash = eval(whole_file)
|
|
|
|
|
|
|
|
hhc = importer.getCachedHHC()
|
|
|
|
handlist = hhc.getProcessedHands()
|
|
|
|
#We _really_ only want to deal with a single hand here.
|
|
|
|
for hand in handlist:
|
|
|
|
ghash = hand.stats.getHandsPlayers()
|
|
|
|
for p in ghash:
|
|
|
|
#print "DEBUG: player: '%s'" % p
|
|
|
|
pstat = ghash[p]
|
|
|
|
teststat = testhash[p]
|
|
|
|
|
|
|
|
for stat in pstat:
|
|
|
|
#print "pstat[%s][%s]: %s == %s" % (p, stat, pstat[stat], teststat[stat])
|
|
|
|
try:
|
|
|
|
if pstat[stat] == teststat[stat]:
|
|
|
|
# The stats match - continue
|
|
|
|
pass
|
|
|
|
else:
|
2011-04-05 04:41:53 +02:00
|
|
|
if stat == 'tourneyTypeId' or stat == 'tourneysPlayersIds' or stat == 'showed':
|
2011-02-27 13:52:17 +01:00
|
|
|
# Not and error
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
errors.error_report(filename, hand, stat, ghash, testhash, p)
|
2010-12-10 16:59:27 +01:00
|
|
|
except KeyError, e:
|
|
|
|
errors.error_report(filename, False, "KeyError: '%s'" % stat, False, False, p)
|
|
|
|
|
|
|
|
def compare_hands_file(filename, importer, errors):
|
|
|
|
hashfilename = filename + '.hands'
|
|
|
|
|
|
|
|
in_fh = codecs.open(hashfilename, 'r', 'utf8')
|
|
|
|
whole_file = in_fh.read()
|
|
|
|
in_fh.close()
|
|
|
|
|
|
|
|
testhash = eval(whole_file)
|
|
|
|
|
|
|
|
hhc = importer.getCachedHHC()
|
|
|
|
handlist = hhc.getProcessedHands()
|
|
|
|
|
|
|
|
for hand in handlist:
|
|
|
|
ghash = hand.stats.getHands()
|
2011-03-30 07:29:39 +02:00
|
|
|
# Delete unused data from hash
|
|
|
|
del ghash['gsc']
|
|
|
|
del ghash['sc']
|
2011-04-06 18:56:19 +02:00
|
|
|
del ghash['id']
|
2011-04-10 15:51:17 +02:00
|
|
|
del ghash['boards']
|
2010-12-10 16:59:27 +01:00
|
|
|
for datum in ghash:
|
|
|
|
#print "DEBUG: hand: '%s'" % datum
|
|
|
|
try:
|
|
|
|
if ghash[datum] == testhash[datum]:
|
|
|
|
# The stats match - continue
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
# Stats don't match.
|
2011-04-06 19:03:04 +02:00
|
|
|
if (datum == "gametypeId"
|
|
|
|
or datum == 'sessionId'
|
|
|
|
or datum == 'tourneyId'
|
|
|
|
or datum == 'gameSessionId'
|
|
|
|
or datum == 'fileId'
|
|
|
|
or datum == 'runIt'):
|
2010-12-10 16:59:27 +01:00
|
|
|
# Not an error. gametypeIds are dependent on the order added to the db.
|
|
|
|
#print "DEBUG: Skipping mismatched gamtypeId"
|
|
|
|
pass
|
|
|
|
else:
|
|
|
|
errors.error_report(filename, hand, datum, ghash, testhash, None)
|
|
|
|
except KeyError, e:
|
2011-01-01 09:35:14 +01:00
|
|
|
errors.error_report(filename, False, "KeyError: '%s'" % datum, False, False, None)
|
2010-12-10 16:59:27 +01:00
|
|
|
|
|
|
|
|
2010-08-28 11:20:50 +02:00
|
|
|
def compare(leaf, importer, errors, site):
|
2010-08-19 12:30:12 +02:00
|
|
|
filename = leaf
|
|
|
|
#print "DEBUG: fileanme: %s" % filename
|
|
|
|
|
|
|
|
# Test if this is a hand history file
|
|
|
|
if filename.endswith('.txt'):
|
|
|
|
# test if there is a .hp version of the file
|
2011-03-30 05:13:03 +02:00
|
|
|
if DEBUG: print "Site: %s" % site
|
|
|
|
if DEBUG: print "Filename: %s" % filename
|
2010-08-28 11:20:50 +02:00
|
|
|
importer.addBulkImportImportFileOrDir(filename, site=site)
|
2010-08-19 12:30:12 +02:00
|
|
|
(stored, dups, partial, errs, ttime) = importer.runImport()
|
2010-09-02 07:42:40 +02:00
|
|
|
|
|
|
|
if errs > 0:
|
|
|
|
errors.error_report(filename, False, "Parse", False, False, False)
|
2010-12-10 16:59:27 +01:00
|
|
|
else:
|
|
|
|
if os.path.isfile(filename + '.hp'):
|
|
|
|
compare_handsplayers_file(filename, importer, errors)
|
|
|
|
if os.path.isfile(filename + '.hands'):
|
|
|
|
compare_hands_file(filename, importer, errors)
|
2011-01-13 07:32:13 +01:00
|
|
|
if os.path.isfile(filename + '.gt'):
|
|
|
|
compare_gametypes_file(filename, importer, errors)
|
2010-08-19 12:30:12 +02:00
|
|
|
|
|
|
|
importer.clearFileList()
|
|
|
|
|
|
|
|
|
|
|
|
|
2010-08-28 11:20:50 +02:00
|
|
|
def walk_testfiles(dir, function, importer, errors, site):
|
2010-08-19 12:30:12 +02:00
|
|
|
"""Walks a directory, and executes a callback on each file """
|
|
|
|
dir = os.path.abspath(dir)
|
2011-02-13 16:43:15 +01:00
|
|
|
try:
|
|
|
|
for file in [file for file in os.listdir(dir) if not file in [".",".."]]:
|
|
|
|
nfile = os.path.join(dir,file)
|
|
|
|
if os.path.isdir(nfile):
|
|
|
|
walk_testfiles(nfile, compare, importer, errors, site)
|
|
|
|
else:
|
|
|
|
function(nfile, importer, errors, site)
|
|
|
|
except OSError as (errno, strerror):
|
|
|
|
if errno == 20:
|
|
|
|
# Error 20 is 'not a directory'
|
|
|
|
function(dir, importer, errors, site)
|
2010-08-19 12:30:12 +02:00
|
|
|
else:
|
2011-02-13 16:43:15 +01:00
|
|
|
raise OSError(errno, strerror)
|
2010-08-19 12:30:12 +02:00
|
|
|
|
2010-12-15 05:50:23 +01:00
|
|
|
def usage():
|
|
|
|
print "USAGE:"
|
2011-01-18 07:31:13 +01:00
|
|
|
print "Run all tests:"
|
|
|
|
print "\t./TestHandsPlayers.py"
|
|
|
|
print "Run tests for a sinlge site:"
|
|
|
|
print "\t./TestHandsPlayers -s <Sitename>"
|
2011-02-13 16:43:15 +01:00
|
|
|
print "Run tests for a sinlge file in a site:"
|
2011-03-12 13:59:22 +01:00
|
|
|
print "\t./TestHandsPlayers -s <Sitename> -f <filename>"
|
2010-12-15 05:50:23 +01:00
|
|
|
sys.exit(0)
|
|
|
|
|
2010-08-19 12:30:12 +02:00
|
|
|
def main(argv=None):
|
|
|
|
if argv is None:
|
|
|
|
argv = sys.argv[1:]
|
|
|
|
|
2010-12-10 11:21:21 +01:00
|
|
|
(options, argv) = Options.fpdb_options()
|
|
|
|
|
|
|
|
test_all_sites = True
|
|
|
|
|
|
|
|
if options.usage == True:
|
2010-12-15 05:50:23 +01:00
|
|
|
usage()
|
2010-12-10 11:21:21 +01:00
|
|
|
|
2011-02-13 16:43:15 +01:00
|
|
|
single_file_test = False
|
|
|
|
|
2010-12-10 11:21:21 +01:00
|
|
|
if options.sitename:
|
2010-12-15 05:50:23 +01:00
|
|
|
options.sitename = Options.site_alias(options.sitename)
|
|
|
|
if options.sitename == False:
|
|
|
|
usage()
|
2011-02-13 16:43:15 +01:00
|
|
|
if options.filename:
|
|
|
|
print "Testing single hand: '%s'" % options.filename
|
|
|
|
single_file_test = True
|
|
|
|
else:
|
|
|
|
print "Only regression testing '%s' files" % (options.sitename)
|
2010-12-10 11:21:21 +01:00
|
|
|
test_all_sites = False
|
|
|
|
|
2010-08-19 12:30:12 +02:00
|
|
|
config = Configuration.Config(file = "HUD_config.test.xml")
|
|
|
|
db = Database.Database(config)
|
|
|
|
sql = SQL.Sql(db_server = 'sqlite')
|
|
|
|
settings = {}
|
|
|
|
settings.update(config.get_db_parameters())
|
|
|
|
settings.update(config.get_import_parameters())
|
|
|
|
settings.update(config.get_default_paths())
|
|
|
|
db.recreate_tables()
|
2010-09-04 19:12:31 +02:00
|
|
|
importer = fpdb_import.Importer(False, settings, config, None)
|
2010-08-19 12:30:12 +02:00
|
|
|
importer.setDropIndexes("don't drop")
|
|
|
|
importer.setFailOnError(True)
|
|
|
|
importer.setThreads(-1)
|
|
|
|
importer.setCallHud(False)
|
|
|
|
importer.setFakeCacheHHC(True)
|
2010-08-24 05:09:13 +02:00
|
|
|
|
2011-03-12 13:59:22 +01:00
|
|
|
PacificPokerErrors= FpdbError('PacificPoker')
|
2010-09-03 06:05:22 +02:00
|
|
|
PokerStarsErrors = FpdbError('PokerStars')
|
|
|
|
FTPErrors = FpdbError('Full Tilt Poker')
|
|
|
|
PartyPokerErrors = FpdbError('Party Poker')
|
|
|
|
BetfairErrors = FpdbError('Betfair')
|
|
|
|
OnGameErrors = FpdbError('OnGame')
|
|
|
|
AbsoluteErrors = FpdbError('Absolute Poker')
|
2010-11-07 13:00:34 +01:00
|
|
|
UltimateBetErrors = FpdbError('Ultimate Bet')
|
2010-09-03 07:56:57 +02:00
|
|
|
EverleafErrors = FpdbError('Everleaf Poker')
|
2011-02-10 05:22:59 +01:00
|
|
|
EverestErrors = FpdbError('Everest Poker')
|
2010-09-03 08:31:52 +02:00
|
|
|
CarbonErrors = FpdbError('Carbon')
|
2010-09-03 12:01:16 +02:00
|
|
|
PKRErrors = FpdbError('PKR')
|
2010-10-07 09:12:06 +02:00
|
|
|
iPokerErrors = FpdbError('iPoker')
|
2010-11-11 11:31:10 +01:00
|
|
|
Win2dayErrors = FpdbError('Win2day')
|
2010-10-07 09:12:06 +02:00
|
|
|
WinamaxErrors = FpdbError('Winamax')
|
2010-09-04 07:11:35 +02:00
|
|
|
|
|
|
|
ErrorsList = [
|
2011-03-12 13:59:22 +01:00
|
|
|
PacificPokerErrors, PokerStarsErrors, FTPErrors, PartyPokerErrors,
|
2010-09-04 07:11:35 +02:00
|
|
|
BetfairErrors, OnGameErrors, AbsoluteErrors,
|
2010-09-06 11:24:08 +02:00
|
|
|
EverleafErrors, CarbonErrors, PKRErrors,
|
2010-11-07 13:00:34 +01:00
|
|
|
iPokerErrors, WinamaxErrors, UltimateBetErrors,
|
2011-02-10 05:22:59 +01:00
|
|
|
Win2dayErrors, EverestErrors,
|
2010-09-04 07:11:35 +02:00
|
|
|
]
|
2010-09-10 06:24:11 +02:00
|
|
|
|
|
|
|
sites = {
|
2011-03-12 13:59:22 +01:00
|
|
|
'PacificPoker' : False,
|
2010-12-10 11:21:21 +01:00
|
|
|
'PokerStars' : False,
|
|
|
|
'Full Tilt Poker' : False,
|
|
|
|
'PartyPoker' : False,
|
|
|
|
'Betfair' : False,
|
|
|
|
'OnGame' : False,
|
|
|
|
'Absolute' : False,
|
|
|
|
'UltimateBet' : False,
|
|
|
|
'Everleaf' : False,
|
|
|
|
'Carbon' : False,
|
|
|
|
#'PKR' : False,
|
|
|
|
'iPoker' : False,
|
|
|
|
'Win2day' : False,
|
|
|
|
'Winamax' : False,
|
2011-02-10 05:22:59 +01:00
|
|
|
'Everest' : False,
|
2010-09-10 06:24:11 +02:00
|
|
|
}
|
|
|
|
|
2010-12-10 11:21:21 +01:00
|
|
|
if test_all_sites == True:
|
|
|
|
for s in sites:
|
|
|
|
sites[s] = True
|
|
|
|
else:
|
|
|
|
sites[options.sitename] = True
|
|
|
|
|
2011-03-12 13:59:22 +01:00
|
|
|
if sites['PacificPoker'] == True and not single_file_test:
|
|
|
|
walk_testfiles("regression-test-files/cash/PacificPoker/", compare, importer, PacificPokerErrors, "PacificPoker")
|
|
|
|
elif sites['PacificPoker'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, PacificPokerErrors, "PacificPoker")
|
|
|
|
|
2011-02-13 16:43:15 +01:00
|
|
|
if sites['PokerStars'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
|
|
|
|
walk_testfiles("regression-test-files/tour/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['PokerStars'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, PokerStarsErrors, "PokerStars")
|
|
|
|
|
|
|
|
if sites['Full Tilt Poker'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
|
|
|
|
walk_testfiles("regression-test-files/tour/FTP/", compare, importer, FTPErrors, "Full Tilt Poker")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Full Tilt Poker'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, FTPErrors, "Full Tilt Poker")
|
|
|
|
if sites['PartyPoker'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
|
|
|
|
walk_testfiles("regression-test-files/tour/PartyPoker/", compare, importer, PartyPokerErrors, "PartyPoker")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['PartyPoker'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, PartyPokerErrors, "PartyPoker")
|
|
|
|
if sites['Betfair'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Betfair/", compare, importer, BetfairErrors, "Betfair")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Betfair'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, BetfairErrors, "Betfair")
|
|
|
|
if sites['OnGame'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/OnGame/", compare, importer, OnGameErrors, "OnGame")
|
2011-04-01 06:49:04 +02:00
|
|
|
walk_testfiles("regression-test-files/tour/ongame/", compare, importer, OnGameErrors, "OnGame")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['OnGame'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, OnGameErrors, "OnGame")
|
|
|
|
if sites['Absolute'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
|
2011-02-13 16:43:15 +01:00
|
|
|
walk_testfiles("regression-test-files/tour/Absolute/", compare, importer, AbsoluteErrors, "Absolute")
|
|
|
|
elif sites['Absolute'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, AbsoluteErrors, "Absolute")
|
|
|
|
if sites['UltimateBet'] == True and not single_file_test:
|
2010-11-07 13:00:34 +01:00
|
|
|
walk_testfiles("regression-test-files/cash/UltimateBet/", compare, importer, UltimateBetErrors, "Absolute")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['UltimateBet'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, UltimateBetErrors, "Absolute")
|
|
|
|
if sites['Everleaf'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
|
2011-03-27 17:30:38 +02:00
|
|
|
walk_testfiles("regression-test-files/tour/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Everleaf'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, EverleafErrors, "Everleaf")
|
|
|
|
if sites['Carbon'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Carbon/", compare, importer, CarbonErrors, "Carbon")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Carbon'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, CarbonErrors, "Carbon")
|
|
|
|
#if sites['PKR'] == True and not single_file_test:
|
2010-12-10 11:21:21 +01:00
|
|
|
# walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR")
|
2011-02-13 16:43:15 +01:00
|
|
|
if sites['iPoker'] == True and not single_file_test:
|
2010-09-10 06:24:11 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/iPoker/", compare, importer, iPokerErrors, "iPoker")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['iPoker'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, iPokerErrors, "iPoker")
|
|
|
|
if sites['Winamax'] == True and not single_file_test:
|
2010-10-07 09:12:06 +02:00
|
|
|
walk_testfiles("regression-test-files/cash/Winamax/", compare, importer, WinamaxErrors, "Winamax")
|
2010-11-26 05:45:41 +01:00
|
|
|
walk_testfiles("regression-test-files/tour/Winamax/", compare, importer, WinamaxErrors, "Winamax")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Winamax'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, WinamaxErrors, "Winamax")
|
|
|
|
if sites['Win2day'] == True and not single_file_test:
|
2010-11-11 11:31:10 +01:00
|
|
|
walk_testfiles("regression-test-files/cash/Win2day/", compare, importer, Win2dayErrors, "Win2day")
|
2011-02-13 16:43:15 +01:00
|
|
|
elif sites['Win2day'] == True and single_file_test:
|
|
|
|
walk_testfiles(options.filename, compare, importer, Win2dayErrors, "Win2day")
|
2010-08-28 10:43:05 +02:00
|
|
|
|
2010-09-04 07:11:35 +02:00
|
|
|
totalerrors = 0
|
|
|
|
|
|
|
|
for i, site in enumerate(ErrorsList):
|
|
|
|
totalerrors += ErrorsList[i].errorcount
|
2010-08-24 05:09:13 +02:00
|
|
|
|
2010-09-04 07:11:35 +02:00
|
|
|
for i, site in enumerate(ErrorsList):
|
|
|
|
ErrorsList[i].print_histogram()
|
|
|
|
|
|
|
|
# Merge the dicts of stats from the various error objects
|
|
|
|
statdict = {}
|
|
|
|
for i, site in enumerate(ErrorsList):
|
|
|
|
tmp = ErrorsList[i].statcount
|
|
|
|
for stat in tmp:
|
|
|
|
if stat in statdict:
|
|
|
|
statdict[stat] += tmp[stat]
|
|
|
|
else:
|
|
|
|
statdict[stat] = tmp[stat]
|
|
|
|
|
|
|
|
print "\n"
|
|
|
|
print "---------------------"
|
|
|
|
print "Errors by stat:"
|
|
|
|
print "---------------------"
|
|
|
|
#for stat in statdict:
|
|
|
|
# print "(%3d) : %s" %(statdict[stat], stat)
|
|
|
|
|
|
|
|
sortedstats = sorted([(value,key) for (key,value) in statdict.items()])
|
|
|
|
for num, stat in sortedstats:
|
|
|
|
print "(%3d) : %s" %(num, stat)
|
|
|
|
|
2011-04-07 07:57:40 +02:00
|
|
|
print "---------------------"
|
|
|
|
print "Total Errors: %d" % totalerrors
|
|
|
|
print "---------------------"
|
2010-08-19 12:30:12 +02:00
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|
|
|
|
|