diff options
Diffstat (limited to 'test/testlib/config.py')
-rw-r--r-- | test/testlib/config.py | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/test/testlib/config.py b/test/testlib/config.py index df2e81b0c..77cacc820 100644 --- a/test/testlib/config.py +++ b/test/testlib/config.py @@ -1,5 +1,5 @@ import testbase -import optparse, os, sys, re, ConfigParser, StringIO, time +import optparse, os, sys, re, ConfigParser, StringIO, time, warnings logging, require = None, None @@ -205,21 +205,29 @@ def _prep_testing_database(options, file_config): from testlib import engines from sqlalchemy import schema - # also create alt schemas etc. here? - e = engines.utf8_engine() - existing = e.table_names() - if existing: + try: + # also create alt schemas etc. here? + e = engines.utf8_engine() + existing = e.table_names() + if existing: + if not options.quiet: + print "Dropping existing tables in database: " + db_url + try: + print "Tables: %s" % ', '.join(existing) + except: + pass + print "Abort within 5 seconds..." + time.sleep(5) + md = schema.MetaData(e, reflect=True) + md.drop_all() + e.dispose() + except (KeyboardInterrupt, SystemExit): + raise + except Exception, e: if not options.quiet: - print "Dropping existing tables in database: " + db_url - try: - print "Tables: %s" % ', '.join(existing) - except: - pass - print "Abort within 5 seconds..." - time.sleep(5) - md = schema.MetaData(e, reflect=True) - md.drop_all() - e.dispose() + warnings.warn(RuntimeWarning( + "Error checking for existing tables in testing " + "database: %s" % e)) post_configure['prep_db'] = _prep_testing_database def _set_table_options(options, file_config): |