~ps-jenkins/autopilot/trusty-proposed

« back to all changes in this revision

Viewing changes to autopilot/tests/unit/test_utilities.py

  • Committer: CI bot
  • Author(s): Christopher Lee
  • Date: 2014-04-01 01:30:22 UTC
  • mfrom: (453.7.5 workaround_failing_pinch_test)
  • Revision ID: ps-jenkins@lists.canonical.com-20140401013022-rg2t68xr6479s5vm
Add workaround for bug lp:1297592 by creating Touch device in AutopilotTestCase setUp. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
#
19
19
 
20
20
from mock import Mock, patch
 
21
import re
21
22
import six
22
23
from testtools import skipIf, TestCase
23
24
from testtools.matchers import (
24
25
    Equals,
25
26
    IsInstance,
26
27
    LessThan,
 
28
    MatchesRegex,
27
29
    Not,
28
30
    raises,
29
31
    Raises,
31
33
import time
32
34
 
33
35
from autopilot.utilities import (
 
36
    _raise_on_unknown_kwargs,
 
37
    cached_result,
 
38
    compatible_repr,
 
39
    deprecated,
34
40
    sleep,
35
 
    compatible_repr,
36
 
    _raise_on_unknown_kwargs,
37
 
    cached_result
38
41
)
39
42
 
40
43
 
138
141
        )
139
142
 
140
143
 
 
144
class DeprecatedDecoratorTests(TestCase):
 
145
 
 
146
    def test_deprecated_logs_warning(self):
 
147
 
 
148
        @deprecated('Testing')
 
149
        def not_testing():
 
150
            pass
 
151
 
 
152
        with patch('autopilot.utilities.logger') as patched_log:
 
153
            not_testing()
 
154
 
 
155
            self.assertThat(
 
156
                patched_log.warning.call_args[0][0],
 
157
                MatchesRegex(
 
158
                    "WARNING: in file \".*.py\", line \d+ in "
 
159
                    "test_deprecated_logs_warning\nThis "
 
160
                    "function is deprecated. Please use 'Testing' instead.\n",
 
161
                    re.DOTALL
 
162
                )
 
163
            )
 
164
 
 
165
 
141
166
class CachedResultTests(TestCase):
142
167
 
143
168
    def get_wrapped_mock_pair(self):