3
from twisted.trial.unittest import TestCase
5
from landscape.lib.warning import hide_warnings
8
class WarningTest(TestCase):
10
super(WarningTest, self).setUp()
11
self.orig_filters = warnings.filters[:]
14
super(WarningTest, self).tearDown()
15
warnings.filters[:] = self.orig_filters
17
def test_hide_warnings(self):
19
filters = warnings.filters[:2]
21
# Warning filters are processed beginning to end, and the first filter
22
# which matches a particular warning is used.
26
# The frontmost should "default" (i.e. print) on UserWarnings
27
[("default", None, UserWarning, None, 0),
28
# The one just behind that should indicate that we should ignore
30
("ignore", None, Warning, None, 0)])