Move NEWIMPORT into config

Fix test_PokerStars test to catch exception when importing with the legacy importer
This commit is contained in:
Worros 2009-11-30 14:33:32 +08:00
parent 152933ed49
commit 36dda2174b
2 changed files with 26 additions and 13 deletions

View File

@ -99,7 +99,7 @@ class Importer:
for i in xrange(self.settings['threads']): for i in xrange(self.settings['threads']):
self.writerdbs.append( Database.Database(self.config, sql = self.sql) ) self.writerdbs.append( Database.Database(self.config, sql = self.sql) )
self.NEWIMPORT = False self.NEWIMPORT = Configuration.NEWIMPORT
#Set functions #Set functions
def setCallHud(self, value): def setCallHud(self, value):

View File

@ -97,16 +97,29 @@ def testStudImport():
(stored, dups, partial, errs, ttime) = importer.runImport() (stored, dups, partial, errs, ttime) = importer.runImport()
importer.clearFileList() importer.clearFileList()
# Should actually do some testing here
assert 1 == 1
def testDrawImport(): def testDrawImport():
db.recreate_tables() try:
importer = fpdb_import.Importer(False, settings, config) db.recreate_tables()
importer.setDropIndexes("don't drop") importer = fpdb_import.Importer(False, settings, config)
importer.setFailOnError(True) importer.setDropIndexes("don't drop")
importer.setThreads(-1) importer.setFailOnError(True)
importer.addBulkImportImportFileOrDir( importer.setThreads(-1)
"""regression-test-files/cash/Stars/Draw/3-Draw-Limit-USD-0.10-0.20-200911.txt""", site="PokerStars") importer.addBulkImportImportFileOrDir(
importer.addBulkImportImportFileOrDir( """regression-test-files/cash/Stars/Draw/3-Draw-Limit-USD-0.10-0.20-200911.txt""", site="PokerStars")
"""regression-test-files/cash/Stars/Draw/5-Carddraw-USD-0.10-0.20-200911.txt""", site="PokerStars") importer.addBulkImportImportFileOrDir(
importer.setCallHud(False) """regression-test-files/cash/Stars/Draw/5-Carddraw-USD-0.10-0.20-200911.txt""", site="PokerStars")
(stored, dups, partial, errs, ttime) = importer.runImport() importer.setCallHud(False)
importer.clearFileList() (stored, dups, partial, errs, ttime) = importer.runImport()
importer.clearFileList()
except FpdbError:
if Configuration.NEWIMPORT == False:
#Old import code doesn't support draw
pass
else:
assert 0 == 1
# Should actually do some testing here
assert 1 == 1