1
0
Fork 0
forked from github/pelican

Merge pull request #3310 from boxydog/fix_3309

Fix collection error with `test_deprecated_attribute` test
This commit is contained in:
Justin Mayer 2024-05-30 07:34:08 +02:00 committed by GitHub
commit f0b6e8732f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -23,9 +23,17 @@ from pelican.tests.support import (
from pelican.writers import Writer
class TestUtils(LoggedTestCase):
class ClassDeprAttr:
_new_attribute = "new_value"
@utils.deprecated_attribute(
old="_old_attribute", new="_new_attribute", since=(3, 1, 0), remove=(4, 1, 3)
)
def _old_attribute():
return None
class TestUtils(LoggedTestCase):
def setUp(self):
super().setUp()
self.temp_output = mkdtemp(prefix="pelicantests.")
@ -34,15 +42,10 @@ class TestUtils(LoggedTestCase):
super().tearDown()
shutil.rmtree(self.temp_output)
@utils.deprecated_attribute(
old="_old_attribute", new="_new_attribute", since=(3, 1, 0), remove=(4, 1, 3)
)
def _old_attribute():
return None
def test_deprecated_attribute(self):
value = self._old_attribute
self.assertEqual(value, self._new_attribute)
test_class = ClassDeprAttr()
value = test_class._old_attribute
self.assertEqual(value, test_class._new_attribute)
self.assertLogCountEqual(
count=1,
msg=(