Python logging.capturewarnings() Examples

The following are code examples for showing how to use logging.capturewarnings(). They are extracted from open source Python projects. You can vote up the examples you like or vote down the ones you don't like. You can also save this page to your account.

Example 1
Project: CodingDojo   Author: ComputerSocietyUNB   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 2
Project: django-cryptography   Author: georgemarshall   File: setup.py    (license) View Source Project 5 votes vote down vote up
def run(self):
        if self.verbosity > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        TestCommand.run(self)
        if self.verbosity > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 3
Project: DjangoBlog   Author: 0daybug   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 4
Project: wanblog   Author: wanzifa   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 5
Project: tabmaster   Author: NicolasMinghetti   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 6
Project: trydjango18   Author: lucifer-yqh   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 7
Project: trydjango18   Author: wei0104   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 8
Project: logo-gen   Author: jellene4eva   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 9
Project: gmail_scanner   Author: brandonhub   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 10
Project: djanoDoc   Author: JustinChavez   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 11
Project: tissuelab   Author: VirtualPlants   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if int(options['verbosity']) > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if int(options['verbosity']) > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 12
Project: geekpoint   Author: Lujinghu   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 13
Project: django-next-train   Author: bitpixdigital   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 14
Project: DjangoZeroToHero   Author: RayParra   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 15
Project: Roboism   Author: markroxor   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler) 
Example 16
Project: django-wechat-api   Author: crazy-canux   File: test.py    (license) View Source Project 5 votes vote down vote up
def execute(self, *args, **options):
        if options['verbosity'] > 0:
            # ensure that deprecation warnings are displayed during testing
            # the following state is assumed:
            # logging.capturewarnings is true
            # a "default" level warnings filter has been added for
            # DeprecationWarning. See django.conf.LazySettings._configure_logging
            logger = logging.getLogger('py.warnings')
            handler = logging.StreamHandler()
            logger.addHandler(handler)
        super(Command, self).execute(*args, **options)
        if options['verbosity'] > 0:
            # remove the testing-specific handler
            logger.removeHandler(handler)