diff options
| author | Jason Kirtland <jek@discorporate.us> | 2007-08-08 20:19:23 +0000 |
|---|---|---|
| committer | Jason Kirtland <jek@discorporate.us> | 2007-08-08 20:19:23 +0000 |
| commit | 7524ea9dd6d7a11d70a0d26b84fd0e4ca1e9c77f (patch) | |
| tree | 7a73f3ec1b3fd9ea2d63c75e710d2b671849bd87 /test/testlib/config.py | |
| parent | 9d7149c9620efaceb95291a8bcf8ce3cd4f9cfee (diff) | |
| download | sqlalchemy-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.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): |
