diff --git a/rally/api.py b/rally/api.py index 0657e865a6..5c66833c3b 100644 --- a/rally/api.py +++ b/rally/api.py @@ -26,7 +26,7 @@ from oslo_config import cfg from requests.packages import urllib3 from rally.common import opts -from rally.common.i18n import _, _LI, _LE, _LW +from rally.common.i18n import _, _LI, _LE from rally.common import logging from rally.common import objects from rally.common.plugin import discover @@ -1106,21 +1106,6 @@ class _Verification(object): "tests": results.tests} -class _DeprecatedAPIClass(object): - """Deprecates direct usage of api classes.""" - def __init__(self, cls): - self._cls = cls - - def __getattr__(self, attr, default=None): - LOG.warning(_LW("'%s' is deprecated since Rally 0.8.0 in favor of " - "'rally.api.API' class.") % self._cls.__name__[1:]) - return getattr(self._cls, attr, default) - - -Deployment = _DeprecatedAPIClass(_Deployment) -Task = _DeprecatedAPIClass(_Task) - - class API(object): CONFIG_SEARCH_PATHS = [sys.prefix + "/etc/rally", "~/.rally", "/etc/rally"] diff --git a/rally/deployment/engines/multihost.py b/rally/deployment/engines/multihost.py index 8446410739..012ff2e52a 100644 --- a/rally/deployment/engines/multihost.py +++ b/rally/deployment/engines/multihost.py @@ -101,4 +101,4 @@ class MultihostEngine(engine.Engine): def cleanup(self): subdeploys = db.deployment_list(parent_uuid=self.deployment["uuid"]) for subdeploy in subdeploys: - rally.api.Deployment.destroy(subdeploy["uuid"]) + rally.api._Deployment.destroy(subdeploy["uuid"]) diff --git a/rally/plugins/common/exporter/file_system.py b/rally/plugins/common/exporter/file_system.py index 33b933e6d2..d031f7dbfa 100644 --- a/rally/plugins/common/exporter/file_system.py +++ b/rally/plugins/common/exporter/file_system.py @@ -63,7 +63,7 @@ class FileExporter(exporter.Exporter): :param uuid: uuid of the task object """ - task = api.Task.get_detailed(uuid) + task = api._Task.get_detailed(uuid) LOG.debug("Got the task object by it's uuid %s. " % uuid) diff --git a/tests/functional/test_task_samples.py b/tests/functional/test_task_samples.py index c9b1dbc98d..66ebda6a14 100644 --- a/tests/functional/test_task_samples.py +++ b/tests/functional/test_task_samples.py @@ -108,9 +108,9 @@ class TestTaskSamples(unittest.TestCase): with open(full_path) as task_file: try: input_task = task_file.read() - rendered_task = api.Task.render_template(input_task) + rendered_task = api._Task.render_template(input_task) task_config = yaml.safe_load(rendered_task) - api.Task.validate("MAIN", task_config) + api._Task.validate("MAIN", task_config) except Exception as e: if not self._skip(six.text_type(e)): print(traceback.format_exc()) diff --git a/tests/unit/deployment/test_multihost.py b/tests/unit/deployment/test_multihost.py index 440e178a57..bb1bd35914 100644 --- a/tests/unit/deployment/test_multihost.py +++ b/tests/unit/deployment/test_multihost.py @@ -111,7 +111,7 @@ class MultihostEngineTestCase(test.TestCase): {"uuid": "uuid2"}] self.engine.cleanup() api_calls = [ - mock.call.Deployment.destroy("uuid1"), - mock.call.Deployment.destroy("uuid2"), + mock.call._Deployment.destroy("uuid1"), + mock.call._Deployment.destroy("uuid2"), ] self.assertEqual(api_calls, mock_api.mock_calls) diff --git a/tests/unit/plugins/common/exporter/test_file_system.py b/tests/unit/plugins/common/exporter/test_file_system.py index 9ecb33d26a..7b7e53ddbb 100644 --- a/tests/unit/plugins/common/exporter/test_file_system.py +++ b/tests/unit/plugins/common/exporter/test_file_system.py @@ -33,11 +33,11 @@ class FileExporterTestCase(test.TestCase): @mock.patch("rally.plugins.common.exporter.file_system.os.path.exists") @mock.patch.object(__builtin__, "open", autospec=True) @mock.patch("rally.plugins.common.exporter.file_system.json.dumps") - @mock.patch("rally.api.Task.get_detailed") - def test_file_exporter_export(self, mock_task_get_detailed, mock_dumps, + @mock.patch("rally.api._Task") + def test_file_exporter_export(self, mock___task, mock_dumps, mock_open, mock_exists): mock_exists.return_value = True - mock_task_get_detailed.return_value = {"results": [{ + mock___task.get_detailed.return_value = {"results": [{ "key": "fake_key", "data": { "raw": "bar_raw", @@ -54,7 +54,7 @@ class FileExporterTestCase(test.TestCase): exporter.export("fake_uuid") mock_open().__enter__().write.assert_called_once_with("fake_results") - mock_task_get_detailed.assert_called_once_with("fake_uuid") + mock___task.get_detailed.assert_called_once_with("fake_uuid") expected_dict = [ { "load_duration": "foo_load_duration", @@ -68,9 +68,9 @@ class FileExporterTestCase(test.TestCase): mock_dumps.assert_called_once_with(expected_dict, sort_keys=False, indent=4, separators=(",", ": ")) - @mock.patch("rally.api.Task.get_detailed") - def test_file_exporter_export_running_task(self, mock_task_get_detailed): - mock_task_get_detailed.return_value = {"results": []} + @mock.patch("rally.api._Task") + def test_file_exporter_export_running_task(self, mock___task): + mock___task.get_detailed.return_value = {"results": []} exporter = file_system.FileExporter("file-exporter:///fake_path.json") self.assertRaises(exceptions.RallyException, exporter.export,