1
0
Fork 0
forked from github/pelican
pelican-theme/pelican/tests/test_testsuite.py
derwinlu e50abb20b3 Add logging for warnings during test suite run
The default configuration for the warnings module changed some time ago
so we lost the ability to detect deprecation warnings and such early.

This commit sets up the test suite to redirect all warnings through our
logging system. Additionally we enable DeprecationWarnings as a default
and throw exceptions on all warnings related to pelican modules.

This enables output of warnings related to dependencies, while letting
tests only fail if the warnings are originating from pelican's source.

Also adding a test to detect if warnings cause an Exception as expected.
2015-10-22 09:45:04 +02:00

16 lines
438 B
Python

# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals
import sys
import warnings
from pelican.tests.support import unittest
class TestSuiteTest(unittest.TestCase):
@unittest.skipIf(sys.version_info[:2] == (3, 3),
"does not throw an exception on python 3.3")
def test_error_on_warning(self):
with self.assertRaises(UserWarning):
warnings.warn('test warning')