THP: Allow a single site to be specified on the cli

The normal mode for running THP is to run though all the tests for all sites:

./TestHandsPlayers.py

This is a bit noisy and slow when trying to fix issues in a single parser.

Added '-s' so that you can run the regression tests against a single site

eg.
./TestHandsPlayers.py -s "Full Tilt Poker"
./TestHandsPlayers.py -s PokerStars
./TestHandsPlayers.py -s Winamax
This commit is contained in:
Worros 2010-12-10 18:21:21 +08:00
parent 3db9cfa6a7
commit 9a956e41b6

View File

@ -28,6 +28,7 @@ import Configuration
import Database import Database
import SQL import SQL
import fpdb_import import fpdb_import
import Options
class FpdbError: class FpdbError:
@ -121,6 +122,19 @@ def main(argv=None):
if argv is None: if argv is None:
argv = sys.argv[1:] argv = sys.argv[1:]
(options, argv) = Options.fpdb_options()
test_all_sites = True
if options.usage == True:
#Print usage examples and exit
print "USAGE:"
sys.exit(0)
if options.sitename:
print "Only regression testing '%s' files" % (options.sitename)
test_all_sites = False
config = Configuration.Config(file = "HUD_config.test.xml") config = Configuration.Config(file = "HUD_config.test.xml")
db = Database.Database(config) db = Database.Database(config)
sql = SQL.Sql(db_server = 'sqlite') sql = SQL.Sql(db_server = 'sqlite')
@ -159,21 +173,27 @@ def main(argv=None):
] ]
sites = { sites = {
'PokerStars' : True, 'PokerStars' : False,
'Full Tilt Poker' : True, 'Full Tilt Poker' : False,
'PartyPoker' : True, 'PartyPoker' : False,
'Betfair' : True, 'Betfair' : False,
'OnGame' : True, 'OnGame' : False,
'Absolute' : True, 'Absolute' : False,
'UltimateBet' : True, 'UltimateBet' : False,
'Everleaf' : True, 'Everleaf' : False,
'Carbon' : True, 'Carbon' : False,
'PKR' : False, #'PKR' : False,
'iPoker' : True, 'iPoker' : False,
'Win2day' : True, 'Win2day' : False,
'Winamax' : True, 'Winamax' : False,
} }
if test_all_sites == True:
for s in sites:
sites[s] = True
else:
sites[options.sitename] = True
if sites['PokerStars'] == True: if sites['PokerStars'] == True:
walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars") walk_testfiles("regression-test-files/cash/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
walk_testfiles("regression-test-files/tour/Stars/", compare, importer, PokerStarsErrors, "PokerStars") walk_testfiles("regression-test-files/tour/Stars/", compare, importer, PokerStarsErrors, "PokerStars")
@ -195,8 +215,8 @@ def main(argv=None):
walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf") walk_testfiles("regression-test-files/cash/Everleaf/", compare, importer, EverleafErrors, "Everleaf")
if sites['Carbon'] == True: if sites['Carbon'] == True:
walk_testfiles("regression-test-files/cash/Carbon/", compare, importer, CarbonErrors, "Carbon") walk_testfiles("regression-test-files/cash/Carbon/", compare, importer, CarbonErrors, "Carbon")
if sites['PKR'] == True: #if sites['PKR'] == True:
walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR") # walk_testfiles("regression-test-files/cash/PKR/", compare, importer, PKRErrors, "PKR")
if sites['iPoker'] == True: if sites['iPoker'] == True:
walk_testfiles("regression-test-files/cash/iPoker/", compare, importer, iPokerErrors, "iPoker") walk_testfiles("regression-test-files/cash/iPoker/", compare, importer, iPokerErrors, "iPoker")
if sites['Winamax'] == True: if sites['Winamax'] == True: