Use stubout instead of manually stubbing out os.path.exists

Change-Id: I76105662003c7dfdea29a9a7dea20b003111e399
This commit is contained in:
Johannes Erdfelt 2012-03-02 22:47:19 +00:00
parent 8a530832c5
commit a7e1fe4291

View File

@ -24,16 +24,16 @@ import tempfile
import unittest
import nova.exception
import nova.test
from nova import test
import nova.wsgi
class TestLoaderNothingExists(unittest.TestCase):
class TestLoaderNothingExists(test.TestCase):
"""Loader tests where os.path.exists always returns False."""
def setUp(self):
self._os_path_exists = os.path.exists
os.path.exists = lambda _: False
super(TestLoaderNothingExists, self).setUp()
self.stubs.Set(os.path, 'exists', lambda _: False)
def test_config_not_found(self):
self.assertRaises(
@ -41,9 +41,6 @@ class TestLoaderNothingExists(unittest.TestCase):
nova.wsgi.Loader,
)
def tearDown(self):
os.path.exists = self._os_path_exists
class TestLoaderNormalFilesystem(unittest.TestCase):
"""Loader tests with normal filesystem (unmodified os.path module)."""