summaryrefslogtreecommitdiff
path: root/test/testlib/config.py
diff options
context:
space:
mode:
authorJason Kirtland <jek@discorporate.us>2007-08-08 20:19:23 +0000
committerJason Kirtland <jek@discorporate.us>2007-08-08 20:19:23 +0000
commit7524ea9dd6d7a11d70a0d26b84fd0e4ca1e9c77f (patch)
tree7a73f3ec1b3fd9ea2d63c75e710d2b671849bd87 /test/testlib/config.py
parent9d7149c9620efaceb95291a8bcf8ce3cd4f9cfee (diff)
downloadsqlalchemy-7524ea9dd6d7a11d70a0d26b84fd0e4ca1e9c77f.tar.gz
Improve utf8 engine handling during test setup and in test suites.
Diffstat (limited to 'test/testlib/config.py')
-rw-r--r--test/testlib/config.py38
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):