Move rally/objects -> rally/common/objects

There is no need to have objects directory on the top level.
They are quite rare changed and in most case one don’t
need to know about internal details of it to fulfill their
task. So hiding these directory under common/* makes perfect sense

Change-Id: Id77bec4e417d61470c9adfd7e43cc50975d76775
This commit is contained in:
Alexander Nevenchannyy
2015-08-05 22:10:13 +03:00
parent 9b2b682bfd
commit 71d51b0c0a
5 changed files with 18 additions and 16 deletions

View File

@@ -21,10 +21,10 @@ from oslo_config import cfg
from rally.common import broker from rally.common import broker
from rally.common.i18n import _ from rally.common.i18n import _
from rally.common import log as logging from rally.common import log as logging
from rally.common import objects
from rally.common import utils as rutils from rally.common import utils as rutils
from rally import consts from rally import consts
from rally import exceptions from rally import exceptions
from rally import objects
from rally import osclients from rally import osclients
from rally.plugins.openstack.wrappers import keystone from rally.plugins.openstack.wrappers import keystone
from rally.plugins.openstack.wrappers import network from rally.plugins.openstack.wrappers import network

View File

@@ -261,19 +261,20 @@ def assert_equal_in(logical_line, filename):
@skip_ignored_lines @skip_ignored_lines
def check_no_direct_rally_objects_import(logical_line, filename): def check_no_direct_rally_objects_import(logical_line, filename):
"""Check if rally.objects are properly imported. """Check if rally.common.objects are properly imported.
If you import "from rally import objects" you are able to use objects If you import "from rally.common import objects" you are able to use
directly like objects.Task. objects directly like objects.Task.
N340 N340
""" """
if filename == "./rally/objects/__init__.py": if filename == "./rally/common/objects/__init__.py":
return return
if (logical_line.startswith("from rally.objects") if (logical_line.startswith("from rally.common.objects")
or logical_line.startswith("import rally.objects.")): or logical_line.startswith("import rally.common.objects.")):
yield (0, "N340: Import objects module: `from rally import objects`. " yield (0, "N340: Import objects module:"
"`from rally.common import objects`. "
"After that you can use directly objects e.g. objects.Task") "After that you can use directly objects e.g. objects.Task")

View File

@@ -27,9 +27,9 @@ from novaclient import exceptions as nova_exceptions
import six import six
from swiftclient import exceptions as swift_exceptions from swiftclient import exceptions as swift_exceptions
from rally.common import objects
from rally.common import utils as rally_utils from rally.common import utils as rally_utils
from rally import consts from rally import consts
from rally import objects
from rally.task import context from rally.task import context
from rally.task.scenarios import base from rally.task.scenarios import base

View File

@@ -15,9 +15,9 @@
import mock import mock
from rally.common import objects
from rally import consts from rally import consts
from rally import exceptions from rally import exceptions
from rally import objects
from rally.plugins.openstack.context.keystone import users from rally.plugins.openstack.context.keystone import users
from tests.unit import test from tests.unit import test

View File

@@ -205,17 +205,18 @@ class HackingTestCase(test.TestCase):
self._assert_bad_samples(checks.assert_equal_in, bad_lines) self._assert_bad_samples(checks.assert_equal_in, bad_lines)
def test_check_no_direct_rally_objects_import(self): def test_check_no_direct_rally_objects_import(self):
bad_imports = ["from rally.objects import task", bad_imports = ["from rally.common.objects import task",
"import rally.objects.task"] "import rally.common.objects.task"]
self._assert_bad_samples(checks.check_no_direct_rally_objects_import, self._assert_bad_samples(checks.check_no_direct_rally_objects_import,
bad_imports) bad_imports)
self._assert_good_samples(checks.check_no_direct_rally_objects_import, self._assert_good_samples(
bad_imports, checks.check_no_direct_rally_objects_import,
module_file="./rally/objects/__init__.py") bad_imports,
module_file="./rally/common/objects/__init__.py")
good_imports = ["from rally import objects"] good_imports = ["from rally.common import objects"]
self._assert_good_samples(checks.check_no_direct_rally_objects_import, self._assert_good_samples(checks.check_no_direct_rally_objects_import,
good_imports) good_imports)