test_utils: Add log count checks to test_deprecated_attribute

This commit is contained in:
W. Trevor King 2013-01-18 07:33:42 -05:00
commit 13b36a5c34

View file

@ -1,16 +1,17 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function from __future__ import unicode_literals, print_function
import logging
import shutil import shutil
import os import os
import datetime import datetime
import time import time
from pelican import utils from pelican import utils
from .support import get_article, unittest from .support import get_article, LoggedTestCase
from pelican.utils import NoFilesError from pelican.utils import NoFilesError
class TestUtils(unittest.TestCase): class TestUtils(LoggedTestCase):
_new_attribute = 'new_value' _new_attribute = 'new_value'
@utils.deprecated_attribute( @utils.deprecated_attribute(
@ -21,7 +22,11 @@ class TestUtils(unittest.TestCase):
def test_deprecated_attribute(self): def test_deprecated_attribute(self):
value = self._old_attribute value = self._old_attribute
self.assertEquals(value, self._new_attribute) self.assertEquals(value, self._new_attribute)
# TODO: check log warning self.assertLogCountEqual(
count=1,
msg=('_old_attribute has been deprecated since 3.1.0 and will be '
'removed by version 4.1.3. Use _new_attribute instead'),
level=logging.WARNING)
def test_get_date(self): def test_get_date(self):
# valid ones # valid ones