Ticket #4298: journalDeprecation-4298.diff

File journalDeprecation-4298.diff, 1.5 KB (added by djfroofy, 6 years ago)
  • twisted/persisted/test/test_journal.py

     
     1# Copyright (c) 2001-2010 Twisted Matrix Laboratories.
     2# See LICENSE for details.
     3
     4"""
     5Tests for deprecation of twisted.persisted.journal
     6"""
     7
     8from twisted.trial.unittest import TestCase
     9
     10
     11class JournalDeprecationTest(TestCase):
     12
     13    def test_deprecated(self):
     14        from twisted.persisted import journal
     15        warnings = self.flushWarnings()
     16        self.assertEquals(
     17            warnings[0]['message'],
     18            'twisted.persisted.journal is deprecated since Twisted 10.0')
     19        self.assertEquals(warnings[0]['category'], DeprecationWarning)
     20        self.assertEquals(len(warnings), 1)
     21
     22
  • twisted/persisted/journal/__init__.py

     
    66"""
    77Command-journalling persistence framework inspired by Prevayler.
    88
     9This package is deprecated.
     10
    911Maintainer: Itamar Shtull-Trauring
    1012"""
     13
     14import warnings
     15warnings.warn(
     16    "twisted.persisted.journal is deprecated since Twisted 10.0",
     17    category=DeprecationWarning,
     18    stacklevel=2)
     19