Matthew Treinish | 9b4d588 | 2013-10-24 20:00:11 +0000 | [diff] [blame] | 1 | # vim: tabstop=4 shiftwidth=4 softtabstop=4 |
| 2 | |
| 3 | # Copyright 2010 United States Government as represented by the |
| 4 | # Administrator of the National Aeronautics and Space Administration. |
| 5 | # Copyright 2013 Hewlett-Packard Development Company, L.P. |
| 6 | # All Rights Reserved. |
| 7 | # |
| 8 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 9 | # not use this file except in compliance with the License. You may obtain |
| 10 | # a copy of the License at |
| 11 | # |
| 12 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 13 | # |
| 14 | # Unless required by applicable law or agreed to in writing, software |
| 15 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 16 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 17 | # License for the specific language governing permissions and limitations |
| 18 | # under the License. |
| 19 | |
| 20 | import fixtures |
| 21 | import mox |
| 22 | |
| 23 | |
| 24 | class MoxStubout(fixtures.Fixture): |
| 25 | """Deal with code around mox and stubout as a fixture.""" |
| 26 | |
| 27 | def setUp(self): |
| 28 | super(MoxStubout, self).setUp() |
| 29 | # emulate some of the mox stuff, we can't use the metaclass |
| 30 | # because it screws with our generators |
| 31 | self.mox = mox.Mox() |
| 32 | self.stubs = self.mox.stubs |
| 33 | self.addCleanup(self.mox.UnsetStubs) |
| 34 | self.addCleanup(self.mox.VerifyAll) |