source: wokkel/test/test_iwokkel.py @ 240:3a201c5b385f

Last change on this file since 240:3a201c5b385f was 240:3a201c5b385f, checked in by Ralph Meijer <ralphm@…>, 4 years ago

Use incremental instead of t.p.versions everywhere

twisted.python.versions is a precursor of the incremental library
but isn't fully API compatible. This caused breakage with older Twisted
versions. Switching to incremental everywhere resolves this. Also fix
the version to at least 16.9.0, which introduced the release_candidate
parameter.

File size: 1.6 KB
Line 
1# Copyright (c) Ralph Meijer.
2# See LICENSE for details.
3
4"""
5Tests for L{wokkel.iwokkel}
6"""
7
8from __future__ import division, absolute_import
9
10from twisted.trial import unittest
11
12class DeprecationTest(unittest.TestCase):
13    """
14    Deprecation test for L{wokkel.subprotocols}.
15    """
16
17    def lookForDeprecationWarning(self, testmethod, attributeName, newName):
18        """
19        Importing C{testmethod} emits a deprecation warning.
20        """
21        warningsShown = self.flushWarnings([testmethod])
22        self.assertEqual(len(warningsShown), 1)
23        self.assertIdentical(warningsShown[0]['category'], DeprecationWarning)
24        self.assertEqual(
25            warningsShown[0]['message'],
26            "wokkel.iwokkel." + attributeName + " "
27            "was deprecated in wokkel 0.7.0: Use " + newName + " instead.")
28
29
30    def test_iXMPPHandler(self):
31        """
32        L{wokkel.iwokkel.IXMPPHandler} is deprecated.
33        """
34        from wokkel.iwokkel import IXMPPHandler
35        IXMPPHandler
36        self.lookForDeprecationWarning(
37                self.test_iXMPPHandler,
38                "IXMPPHandler",
39                "twisted.words.protocols.jabber.ijabber."
40                    "IXMPPHandler")
41
42
43    def test_iXMPPHandlerCollection(self):
44        """
45        L{wokkel.iwokkel.IXMPPHandlerCollection} is deprecated.
46        """
47        from wokkel.iwokkel import IXMPPHandlerCollection
48        IXMPPHandlerCollection
49        self.lookForDeprecationWarning(
50                self.test_iXMPPHandlerCollection,
51                "IXMPPHandlerCollection",
52                "twisted.words.protocols.jabber.ijabber."
53                    "IXMPPHandlerCollection")
Note: See TracBrowser for help on using the repository browser.