Open test xenapi/vm_rrd.xml relative to tests.

The test xenapi/vm_rrd.xml file was opened in test_xenapi.py relative to
the current working directory. This forced you to run unittests out of
the nova/tests directory. Open the xenapi/vm_rrd.xml relative to the
test_xenapi.py file so that the current working directory does not
matter.

Part of blueprint grizzly-testtools

Change-Id: I2b8720ea418e10e9748adaa599513794202351e6
This commit is contained in:
Clark Boylan
2012-11-30 13:28:57 -08:00
parent 134ca013f7
commit 19fb7ec435

View File

@@ -345,7 +345,8 @@ class XenAPIVMTestCase(stubs.XenAPITestBase):
def test_get_diagnostics(self):
def fake_get_rrd(host, vm_uuid):
with open('xenapi/vm_rrd.xml') as f:
path = os.path.dirname(os.path.realpath(__file__))
with open(os.path.join(path, 'xenapi/vm_rrd.xml')) as f:
return re.sub(r'\s', '', f.read())
self.stubs.Set(vm_utils, '_get_rrd', fake_get_rrd)