Question

I'm using Pyramid and SQLAlchemy and I have a bunch of tests. From time to time, I notice SAWarnings being issued while tests run. I hunt them down and make them go away.

The most common SAWarning I see is:

......eggs/SQLAlchemy-0.9.3-py2.7.egg/sqlalchemy/engine/default.py:562: SAWarning: Unicode type received non-unicode bind param value.

Now, I'd like my test suite to fail immediately after a SAWarning is found. How do I do this?

Was it helpful?

Solution

use the python warnings filter:

import warnings
warnings.simplefilter("error")
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top