Debian Codegraph @

reno/tests/base.py

raw symbols SCIP
1 # -*- coding: utf-8 -*-
2
3 # Copyright 2010-2011 OpenStack Foundation
4 # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License"); you may
7 # not use this file except in compliance with the License. You may obtain
8 # a copy of the License at
9 #
10 # http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15 # License for the specific language governing permissions and limitations
16 # under the License.
17
18 import fixtures
19 import testtools
20
21
22 class TestCase(testtools.TestCase):
23
24 """Test case base class for all unit tests."""
25
26 def setUp(self):
27 super(TestCase, self).setUp()
28 self._stdout_fixture = fixtures.StringStream('stdout')
29 self.stdout = self.useFixture(self._stdout_fixture).stream
30 self.useFixture(fixtures.MonkeyPatch('sys.stdout', self.stdout))
31 self._stderr_fixture = fixtures.StringStream('stderr')
32 self.stderr = self.useFixture(self._stderr_fixture).stream
33 self.useFixture(fixtures.MonkeyPatch('sys.stderr', self.stderr))
34 self.useFixture(fixtures.FakeLogger())