mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
test_utils: Add log count checks to test_deprecated_attribute
This commit is contained in:
parent
4fcdaa91e9
commit
13b36a5c34
1 changed files with 8 additions and 3 deletions
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue