Skip to content

Commit

Permalink
Add a mechanism to save update.db from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
nthomas-mozilla committed Aug 8, 2012
1 parent bea9464 commit 1959989
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test-rules.py
Expand Up @@ -150,6 +150,7 @@ def isValidTestDir(d):
parser.add_option("", "--dump-rules", dest="dumprules", action="store_true", help="dump rules to stdout")
parser.add_option("", "--dump-releases", dest="dumpreleases", action="store_true", help="dump release data to stdout")
parser.add_option("-v", "--verbose", dest="verbose", action="store_true", help="verbose output for snippet checking")
parser.add_option("-k", "--keep-db", dest="keepDB", action="store_true", help="save a copy of the test db in thetest dir")

options, args = parser.parse_args()

Expand All @@ -168,7 +169,15 @@ def isValidTestDir(d):

for td in options.testDirs:
log.info("Testing %s", td)
AUS = AUS3(dbname='sqlite:///:memory:')
if options.keepDB:
dbPath = os.path.join(td, 'update.db')
if os.path.exists(dbPath):
os.remove(dbPath)
log.info('saving db at %s' % dbPath)
dbPath = 'sqlite:///%s' % dbPath
else:
dbPath = 'sqlite:///:memory:'
AUS = AUS3(dbname=dbPath)
AUS.createTables()
populateDB(AUS, td)
if options.dumprules:
Expand Down

0 comments on commit 1959989

Please sign in to comment.