]> review.fuel-infra Code Review - openstack-build/neutron-build.git/commitdiff
Dropped fixture module
authorIhar Hrachyshka <ihrachys@redhat.com>
Fri, 5 Dec 2014 21:41:02 +0000 (22:41 +0100)
committerIhar Hrachyshka <ihrachys@redhat.com>
Thu, 15 Jan 2015 14:13:40 +0000 (15:13 +0100)
The only single remaining usage of those fixtures in the tree was for
oslo.config fixture, which is now available via oslo.config library
itself.

Change-Id: I997a3a086598a8addf093790db102cd130588d95
Closes-Bug: #1399804

neutron/openstack/common/fixture/__init__.py [deleted file]
neutron/openstack/common/fixture/config.py [deleted file]
neutron/openstack/common/fixture/lockutils.py [deleted file]
neutron/openstack/common/fixture/mockpatch.py [deleted file]
neutron/openstack/common/fixture/moxstubout.py [deleted file]
neutron/tests/functional/db/test_migrations.py
openstack-common.conf

diff --git a/neutron/openstack/common/fixture/__init__.py b/neutron/openstack/common/fixture/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/neutron/openstack/common/fixture/config.py b/neutron/openstack/common/fixture/config.py
deleted file mode 100644 (file)
index 0bf90ff..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-# Copyright 2013 Mirantis, Inc.
-# Copyright 2013 OpenStack Foundation
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-import fixtures
-from oslo.config import cfg
-import six
-
-
-class Config(fixtures.Fixture):
-    """Override some configuration values.
-
-    The keyword arguments are the names of configuration options to
-    override and their values.
-
-    If a group argument is supplied, the overrides are applied to
-    the specified configuration option group.
-
-    All overrides are automatically cleared at the end of the current
-    test by the reset() method, which is registered by addCleanup().
-    """
-
-    def __init__(self, conf=cfg.CONF):
-        self.conf = conf
-
-    def setUp(self):
-        super(Config, self).setUp()
-        self.addCleanup(self.conf.reset)
-
-    def config(self, **kw):
-        group = kw.pop('group', None)
-        for k, v in six.iteritems(kw):
-            self.conf.set_override(k, v, group)
diff --git a/neutron/openstack/common/fixture/lockutils.py b/neutron/openstack/common/fixture/lockutils.py
deleted file mode 100644 (file)
index 90932c5..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2011 OpenStack Foundation.
-# All Rights Reserved.
-#
-#    Licensed under the Apache License, Version 2.0 (the "License"); you may
-#    not use this file except in compliance with the License. You may obtain
-#    a copy of the License at
-#
-#         http://www.apache.org/licenses/LICENSE-2.0
-#
-#    Unless required by applicable law or agreed to in writing, software
-#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-#    License for the specific language governing permissions and limitations
-#    under the License.
-
-import fixtures
-
-from neutron.openstack.common import lockutils
-
-
-class LockFixture(fixtures.Fixture):
-    """External locking fixture.
-
-    This fixture is basically an alternative to the synchronized decorator with
-    the external flag so that tearDowns and addCleanups will be included in
-    the lock context for locking between tests. The fixture is recommended to
-    be the first line in a test method, like so::
-
-        def test_method(self):
-            self.useFixture(LockFixture)
-                ...
-
-    or the first line in setUp if all the test methods in the class are
-    required to be serialized. Something like::
-
-        class TestCase(testtools.testcase):
-            def setUp(self):
-                self.useFixture(LockFixture)
-                super(TestCase, self).setUp()
-                    ...
-
-    This is because addCleanups are put on a LIFO queue that gets run after the
-    test method exits. (either by completing or raising an exception)
-    """
-    def __init__(self, name, lock_file_prefix=None):
-        self.mgr = lockutils.lock(name, lock_file_prefix, True)
-
-    def setUp(self):
-        super(LockFixture, self).setUp()
-        self.addCleanup(self.mgr.__exit__, None, None, None)
-        self.mgr.__enter__()
diff --git a/neutron/openstack/common/fixture/mockpatch.py b/neutron/openstack/common/fixture/mockpatch.py
deleted file mode 100644 (file)
index 858e77c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# Copyright 2013 Hewlett-Packard Development Company, L.P.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import fixtures
-import mock
-
-
-class PatchObject(fixtures.Fixture):
-    """Deal with code around mock."""
-
-    def __init__(self, obj, attr, **kwargs):
-        self.obj = obj
-        self.attr = attr
-        self.kwargs = kwargs
-
-    def setUp(self):
-        super(PatchObject, self).setUp()
-        _p = mock.patch.object(self.obj, self.attr, **self.kwargs)
-        self.mock = _p.start()
-        self.addCleanup(_p.stop)
-
-
-class Patch(fixtures.Fixture):
-
-    """Deal with code around mock.patch."""
-
-    def __init__(self, obj, **kwargs):
-        self.obj = obj
-        self.kwargs = kwargs
-
-    def setUp(self):
-        super(Patch, self).setUp()
-        _p = mock.patch(self.obj, **self.kwargs)
-        self.mock = _p.start()
-        self.addCleanup(_p.stop)
diff --git a/neutron/openstack/common/fixture/moxstubout.py b/neutron/openstack/common/fixture/moxstubout.py
deleted file mode 100644 (file)
index e8c031f..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-# Copyright 2010 United States Government as represented by the
-# Administrator of the National Aeronautics and Space Administration.
-# Copyright 2013 Hewlett-Packard Development Company, L.P.
-# All Rights Reserved.
-#
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
-# not use this file except in compliance with the License. You may obtain
-# a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-# License for the specific language governing permissions and limitations
-# under the License.
-
-import fixtures
-import mox
-
-
-class MoxStubout(fixtures.Fixture):
-    """Deal with code around mox and stubout as a fixture."""
-
-    def setUp(self):
-        super(MoxStubout, self).setUp()
-        # emulate some of the mox stuff, we can't use the metaclass
-        # because it screws with our generators
-        self.mox = mox.Mox()
-        self.stubs = self.mox.stubs
-        self.addCleanup(self.mox.UnsetStubs)
-        self.addCleanup(self.mox.VerifyAll)
index 24c971bb1d7ab253bdb72fe21a1d3a4f70f129d4..8088864043a6a45a709f038497b910e3cf0c00c6 100644 (file)
@@ -20,13 +20,13 @@ import alembic.autogenerate
 import alembic.migration
 import mock
 from oslo.config import cfg
+from oslo.config import fixture as config_fixture
 from oslo.db.sqlalchemy import test_base
 from oslo.db.sqlalchemy import test_migrations
 import sqlalchemy
 
 from neutron.db.migration import cli as migration
 from neutron.db.migration.models import head as head_models
-from neutron.openstack.common.fixture import config
 
 LOG = logging.getLogger(__name__)
 
@@ -130,7 +130,7 @@ class _TestModelsMigrations(test_migrations.ModelsMigrationsSync):
         patch.start()
         self.addCleanup(patch.stop)
         super(_TestModelsMigrations, self).setUp()
-        self.cfg = self.useFixture(config.Config())
+        self.cfg = self.useFixture(config_fixture.Config())
         self.cfg.config(core_plugin=CORE_PLUGIN)
         self.alembic_config = migration.get_alembic_config()
         self.alembic_config.neutron_config = cfg.CONF
index 358d86f1c17568f8f35c9e1e65316aea56ba3959..f3195375d78552f9d9552900df5a87fbb8e84b08 100644 (file)
@@ -3,7 +3,6 @@
 module=cache
 module=eventlet_backdoor
 module=fileutils
-module=fixture
 module=install_venv_common
 module=local
 module=lockutils