Domanda

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?

È stato utile?

Soluzione

use the python warnings filter:

import warnings
warnings.simplefilter("error")
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top