Skip to content

Commit

Permalink
Merge pull request #3310 from boxydog/fix_3309
Browse files Browse the repository at this point in the history
Fix collection error with `test_deprecated_attribute` test
  • Loading branch information
justinmayer authored May 30, 2024
2 parents e4d7f0a + 1001dcb commit f0b6e87
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions pelican/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@
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.")
Expand All @@ -34,15 +42,10 @@ def tearDown(self):
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=(
Expand Down

0 comments on commit f0b6e87

Please sign in to comment.