]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Fix state_path in tests
authorAssaf Muller <amuller@redhat.com>
Fri, 29 Aug 2014 11:44:10 +0000 (14:44 +0300)
committerAssaf Muller <amuller@redhat.com>
Fri, 29 Aug 2014 14:42:07 +0000 (17:42 +0300)
cfg.CONF.state_path is set to a random temporary directory
in neutron.tests.base:BaseTestCase.setUp. This value was then
over written in neutron.tests.unit.__init__. Tests that need
to read or pass cfg.CONF.state_path were getting the directory
from which the tests were running and not the temporary directory
specially created for the current test run. Note that the usage
of state_path to set lock_path, dhcp state path and the likes
was working as expected, and was not affected by this bug.

Closes-Bug: #1363058
Change-Id: Ib45f663fadaf0f3b4a79a0db4128822187b61ecc

neutron/tests/unit/__init__.py
neutron/tests/unit/test_config.py

index 282187de452df2b20781f1130f8731d5eefc0c0a..3e3c66c01f62630e43b5da583d32ea6394d5afff 100644 (file)
 #    License for the specific language governing permissions and limitations
 #    under the License.
 
-import os
-
 from oslo.config import cfg
 
 
-reldir = os.path.join(os.path.dirname(__file__), '..', '..', '..')
-absdir = os.path.abspath(reldir)
-cfg.CONF.state_path = absdir
 cfg.CONF.use_stderr = False
index 97c61bdedea4455ec0a46353637cc4dd26b52d87..63d36a70c4b53c341ffcd99603e5b5d5aadd9bd7 100644 (file)
@@ -13,8 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os
-
 import mock
 from oslo.config import cfg
 
@@ -42,10 +40,6 @@ class ConfigurationTest(base.BaseTestCase):
         self.assertTrue(cfg.CONF.allow_bulk)
         self.assertEqual(5, cfg.CONF.max_dns_nameservers)
         self.assertEqual(20, cfg.CONF.max_subnet_host_routes)
-        relative_dir = os.path.join(os.path.dirname(__file__),
-                                    '..', '..', '..')
-        absolute_dir = os.path.abspath(relative_dir)
-        self.assertEqual(absolute_dir, cfg.CONF.state_path)
         self.assertEqual(86400, cfg.CONF.dhcp_lease_duration)
         self.assertFalse(cfg.CONF.allow_overlapping_ips)
         self.assertEqual('neutron', cfg.CONF.control_exchange)