Ticket #6547: my-twisted-patch2.patch

File my-twisted-patch2.patch, 2.2 KB (added by mulhern, 8 years ago)
  • twisted/mail/test/test_pb.py

     
     1# Copyright (c) Twisted Matrix Laboratories.
     2# See LICENSE for details.
     3
     4"""
     5L{twisted.mail.pb} is a deprecated module. This test just verifies that
     6the deprecation warning is triggered correctly.
     7"""
     8
     9from twisted.trial import unittest
     10
     11from twisted import mail
     12
     13class ModuleDeprecatedTest(unittest.TestCase):
     14    """
     15    Tests that the L{twisted.mail.pb} module is deprecated.
     16    """
     17
     18    def test_deprecation(self):
     19        """
     20        Tests that a DeprecationWarning is signalled if the
     21        L{mail.twisted.pb} module is loaded.
     22        """
     23
     24        import twisted.mail.pb
     25        warningsShown = self.flushWarnings([self.test_deprecation])
     26        self.assertEqual(len(warningsShown), 1)
     27        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
     28        self.assertEqual(
     29            warningsShown[0]['message'],
     30            "twisted.mail.pb was deprecated in Twisted 13.1.0: "
     31            "Please use a real mail protocol, e.g., imap or pop.")
  • twisted/mail/topfiles/6547.removal

     
     1twisted.mail.pb deprecated because it is incomplete and unused.
  • twisted/mail/pb.py

     
    11# Copyright (c) Twisted Matrix Laboratories.
    22# See LICENSE for details.
    33
     4"""
     5Deprecated in Twisted 13.1.0; please use a real mail protocol, e.g., imap.
     6"""
    47
    58from twisted.spread import pb
    69from twisted.spread import banana
    710
    811import os
    912import types
     13import warnings
    1014
     15warnings.warn(
     16    "twisted.mail.pb was deprecated in Twisted 13.1.0: "
     17    "Please use a real mail protocol, e.g., imap or pop.",
     18    DeprecationWarning,
     19    stacklevel=2)
     20
    1121class Maildir(pb.Referenceable):
    1222
    1323    def __init__(self, directory, rootDirectory):