Rename rally.cmd to rally.cli

There is module 'cmd' in standard library, and unittest's discover
does modify sys.path when running tests. This cause errors when running
unit tests in some environments (E.g. pycharm)

Change-Id: I4fd2d271da1b7fd300fbbeb6107aa958e716fd2b
Closes-Bug: 1457162
This commit is contained in:
Sergey Skripnick 2015-05-20 22:10:22 +03:00
parent 4e7bea0c68
commit 54350da689
4 changed files with 22 additions and 22 deletions

View File

@ -25,8 +25,8 @@ packages =
[entry_points]
console_scripts =
rally = rally.cmd.main:main
rally-manage = rally.cmd.manage:main
rally = rally.cli.main:main
rally-manage = rally.cli.manage:main
oslo.config.opts =
rally = rally.common.opts:list_opts

View File

@ -19,7 +19,7 @@ import unittest
import mock
from rally.cmd import envutils
from rally.cli import envutils
from tests.functional import utils
@ -71,7 +71,7 @@ class DeploymentTestCase(unittest.TestCase):
def test_check_fail(self):
with mock.patch.dict("os.environ", utils.TEST_ENV):
self.rally("deployment create --name t_create_env --fromenv")
self.assertRaises(utils.RallyCmdError, self.rally,
self.assertRaises(utils.RallyCliError, self.rally,
("deployment check"))
def test_recreate(self):
@ -89,4 +89,4 @@ class DeploymentTestCase(unittest.TestCase):
self.rally("deployment create --name t_create_env2 --fromenv")
self.rally("deployment use --deployment %s" % uuid)
current_deployment = envutils.get_global("RALLY_DEPLOYMENT")
self.assertEqual(uuid, current_deployment)
self.assertEqual(uuid, current_deployment)

View File

@ -20,7 +20,7 @@ import unittest
import mock
from rally.cmd import envutils
from rally.cli import envutils
from tests.functional import utils
@ -95,37 +95,37 @@ class TaskTestCase(unittest.TestCase):
def test_results_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task results --uuid %s" % FAKE_TASK_UUID)
def test_abort_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task abort --uuid %s" % FAKE_TASK_UUID)
def test_delete_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task delete --uuid %s" % FAKE_TASK_UUID)
def test_detailed_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task detailed --uuid %s" % FAKE_TASK_UUID)
def test_report_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task report --tasks %s" % FAKE_TASK_UUID)
def test_sla_check_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task sla_check --uuid %s" % FAKE_TASK_UUID)
def test_status_with_wrong_task_id(self):
rally = utils.Rally()
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task status --uuid %s" % FAKE_TASK_UUID)
def test_report_one_uuid(self):
@ -136,7 +136,7 @@ class TaskTestCase(unittest.TestCase):
rally("task report --out %s" % rally.gen_report_path(extension="html"))
self.assertTrue(os.path.exists(
rally.gen_report_path(extension="html")))
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task report --report %s" % FAKE_TASK_UUID)
def test_report_bunch_uuids(self):
@ -196,7 +196,7 @@ class TaskTestCase(unittest.TestCase):
rally.gen_report_path(extension="html")))
self.assertTrue(os.path.exists(
rally.gen_report_path(extension="html")))
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task report --report %s" % FAKE_TASK_UUID)
def test_delete(self):
@ -228,7 +228,7 @@ class TaskTestCase(unittest.TestCase):
self.assertIn(
"deployment_name", rally("task list --all-deployments"))
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally, "task list --status not_existing_status")
def test_list_with_print_uuids_option(self):
@ -274,7 +274,7 @@ class TaskTestCase(unittest.TestCase):
deployment_id = envutils.get_global("RALLY_DEPLOYMENT")
cfg = {"invalid": "config"}
config = utils.TaskConfig(cfg)
self.assertRaises(utils.RallyCmdError,
self.assertRaises(utils.RallyCliError,
rally,
("task validate --task %(task_file)s "
"--deployment %(deployment_id)s") %
@ -556,7 +556,7 @@ class SLATestCase(unittest.TestCase):
cfg = self._get_sample_task_config(max_seconds_per_iteration=0.001)
config = utils.TaskConfig(cfg)
rally("task start --task %s" % config.filename)
self.assertRaises(utils.RallyCmdError, rally, "task sla_check")
self.assertRaises(utils.RallyCliError, rally, "task sla_check")
def test_sla_success(self):
rally = utils.Rally()
@ -609,7 +609,7 @@ class SLAExtraFlagsTestCase(unittest.TestCase):
]
try:
rally("task sla_check --json", getjson=True)
except utils.RallyCmdError as expected_error:
except utils.RallyCliError as expected_error:
self.assertEqual(json.loads(expected_error.output), expected)
else:
self.fail("`rally task sla_check` command should return non-zero "
@ -637,7 +637,7 @@ class SLAExtraFlagsTestCase(unittest.TestCase):
]
try:
rally("task sla_check --json", getjson=True)
except utils.RallyCmdError as expected_error:
except utils.RallyCliError as expected_error:
self.assertEqual(json.loads(expected_error.output), expected)
else:
self.fail("`rally task sla_check` command should return non-zero "

View File

@ -34,7 +34,7 @@ TEST_ENV = {
DEPLOYMENT_FILE = "/tmp/rally_functests_main_deployment.json"
class RallyCmdError(Exception):
class RallyCliError(Exception):
def __init__(self, code, output):
self.code = code
@ -184,4 +184,4 @@ class Rally(object):
return json.loads(output)
return output
except subprocess.CalledProcessError as e:
raise RallyCmdError(e.returncode, e.output)
raise RallyCliError(e.returncode, e.output)