OK, so it ought to be: error::sqlalchemy.exc.SAWarning
...instead, but that doesn't work because of https://bugs.python.org/issue22543, so you need to do it in code. I have this in my top-level py.test conftest.py: @pytest.fixture(scope='session', autouse=True) def sqlalchemywarnings(): "Convert SQLAlchemy warnings to exceptions" import sqlalchemy.exc warnings.simplefilter( 'error', sqlalchemy.exc.SAWarning ) Simon On Thu, Sep 15, 2016 at 3:09 PM, Simon King <si...@simonking.org.uk> wrote: > According to https://docs.python.org/2/using/cmdline.html#cmdoption-W, > the full form of -W (and PYTHONWARNINGS) is: > > action:message:category:module:line > > Empty fields are ignored, and unused trailing fields can be left out, > so maybe "error::SAWarning" would work? > > Simon > > On Thu, Sep 15, 2016 at 2:38 PM, Chris Withers <ch...@simplistix.co.uk> wrote: >> Right, but then a bunch of other errors (ImportWarning?!, >> DeprecationWarning, etc) stop execution even reaching the code which might >> be causing the SAWarning. >> >> It's really quite disappointing that Python's warning mechanisms don't >> report a full traceback... >> >> >> >> On 15/09/2016 13:43, Mike Bayer wrote: >>> >>> >>> import warnings >>> >>> warnings.simplefilter("error") >>> >>> >>> >>> On 09/15/2016 08:07 AM, Chris Withers wrote: >>>> >>>> Hi All, >>>> >>>> How can I turn SAWarnings into exceptions? >>>> >>>> I'm struggling with what to put into the PYTHONWARNINGS environment >>>> variable :-S >>>> >>>> cheers, >>>> >>>> Chris >>>> >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sqlalchemy" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to sqlalchemy+unsubscr...@googlegroups.com. >> To post to this group, send email to sqlalchemy@googlegroups.com. >> Visit this group at https://groups.google.com/group/sqlalchemy. >> For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sqlalchemy+unsubscr...@googlegroups.com. To post to this group, send email to sqlalchemy@googlegroups.com. Visit this group at https://groups.google.com/group/sqlalchemy. For more options, visit https://groups.google.com/d/optout.