Testsuite: Turn SQLAlchemy warnings into errors
authorElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 23 Dec 2012 22:52:08 +0000 (23:52 +0100)
committerElrond <elrond+mediagoblin.org@samba-tng.org>
Sun, 23 Dec 2012 22:52:08 +0000 (23:52 +0100)
We should handle SQLAlchemy warnings. And to make that a
lot easier, turn them into real errors. That way they
1) Turn up more prominently.
2) Have a useful backtrace.

This only happens in the testsuite, so that normal useage
is not impacted.

mediagoblin/tests/__init__.py

index 4e84914ae76bf6d1ffa702c1419e3be60253c3b8..5a3235c651bee2ed149db6946e6d251f3b62588e 100644 (file)
@@ -25,6 +25,10 @@ from mediagoblin.tests.tools import (
 def setup_package():
     suicide_if_bad_celery_environ()
 
+    import warnings
+    from sqlalchemy.exc import SAWarning
+    warnings.simplefilter("error", SAWarning)
+
 
 def teardown_package():
     # Remove and reinstall user_dev directories