def test_exception_filter(): class FakeRecord: pass fr = ExceptionFilter() rc = FakeRecord() rc.exc_info = (ThingDropped, None, None) assert not fr.filter(rc) rc.exc_info = (OSError, None, None) assert fr.filter(rc)
"""setting module for your project""" import os import logging import asyncio from ant_nest.exceptions import ExceptionFilter ANT_PACKAGES = ["ants"] ANT_ENV = os.getenv("ANT_ENV", "production") if ANT_ENV in ("development", "testing"): logging.basicConfig(level=logging.DEBUG) asyncio.get_event_loop().set_debug(True) else: logging.basicConfig(level=logging.INFO) logging.getLogger().addFilter(ExceptionFilter()) # your ant`s class modules or packages # custom setting, eg: # MYSQL_HOST = '127.0.0.1'