From 19fb7ec435e1370fe4f67799c315bdc153e43c0c Mon Sep 17 00:00:00 2001 From: Clark Boylan Date: Fri, 30 Nov 2012 13:28:57 -0800 Subject: [PATCH] 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 --- nova/tests/test_xenapi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/nova/tests/test_xenapi.py b/nova/tests/test_xenapi.py index c23e4257..6d068625 100644 --- a/nova/tests/test_xenapi.py +++ b/nova/tests/test_xenapi.py @@ -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)