~ntt-pf-lab/nova/monkey_patch_notification

« back to all changes in this revision

Viewing changes to vendor/Twisted-10.0.0/twisted/test/test_timehelpers.py

  • Committer: Jesse Andrews
  • Date: 2010-05-28 06:05:26 UTC
  • Revision ID: git-v1:bf6e6e718cdc7488e2da87b21e258ccc065fe499
initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (c) 2010 Twisted Matrix Laboratories.
 
2
# See LICENSE for details.
 
3
 
 
4
"""
 
5
Tests for the deprecated L{twisted.test.time_helpers} module.
 
6
"""
 
7
 
 
8
import sys
 
9
 
 
10
from twisted.trial.unittest import TestCase
 
11
 
 
12
 
 
13
class TimeHelpersTests(TestCase):
 
14
    """
 
15
    A test for the deprecation of the module.
 
16
    """
 
17
    def test_deprecated(self):
 
18
        """
 
19
        Importing L{twisted.test.time_helpers} causes a deprecation warning
 
20
        to be emitted.
 
21
        """
 
22
        # Make sure we're really importing it
 
23
        sys.modules.pop('twisted.test.time_helpers', None)
 
24
        import twisted.test.time_helpers
 
25
        warnings = self.flushWarnings(
 
26
            offendingFunctions=[self.test_deprecated])
 
27
        self.assertEquals(warnings[0]['category'], DeprecationWarning)
 
28
        self.assertEquals(
 
29
            warnings[0]['message'],
 
30
            "twisted.test.time_helpers is deprecated since Twisted 10.0.  "
 
31
            "See twisted.internet.task.Clock instead.")