Ticket #6395: deprecated_msn_added_corrections.patch

File deprecated_msn_added_corrections.patch, 2.3 KB (added by Indradhanush Gupta, 6 years ago)

Added NEWS File and tests to deprecate twisted.words.protocols.msn

  • twisted/words/test/test_msn.py

     
    2323    # Otherwise importing it should work, so do it.
    2424    from twisted.words.protocols import msn
    2525
    26 
     26from twisted.trial import unittest
    2727from twisted.python.hashlib import md5
    2828from twisted.protocols import loopback
    2929from twisted.internet.defer import Deferred
     
    520520        testClass.skip = (
    521521            "MSN requires an HTTP client but none is available, "
    522522            "skipping tests.")
     523
     524
     525class Deprecations(unittest.TestCase):
     526    """
     527    Tests to ensure deprecation of L{twisted.words.protocols.msn}
     528    """
     529
     530    def ensureDeprecated(self, message):
     531        """
     532        Ensures that the correct deprecation warning was issued.
     533        """
     534        warnings = self.flushWarnings()
     535        self.assertIdentical(warnings[0]['category'], DeprecationWarning)
     536        self.assertEqual(warnings[0]['message'], message)
     537        self.assertEqual(len(warnings), 1)
     538
     539
     540    def test_msn(self):
     541        """
     542        The L{twisted.words.protocols.msn} module is deprecated
     543        """
     544        from twisted.words.protocols import msn
     545        self.ensureDeprecated("twisted.words.protocols.msn was deprecated "
     546                              "in Twisted 13.0.0")
  • twisted/words/protocols/__init__.py

     
     1# Copyright (c) Twisted Matrix Laboratories.
     2# See LICENSE for details.
     3
    14"Chat protocols"
     5
     6from twisted.python import deprecate, versions
     7
     8deprecate.deprecatedModuleAttribute(
     9        versions.Version("Twisted", 13, 0, 0),
     10        "MSN is being shut down. Client code has no usefulness on its own.",
     11        "twisted.words.protocols.msn.py",
     12        "msn")
  • twisted/words/topfiles/6395.removal

     
     1twisted.words.protocols.msn is now deprecated.