diff options
author | Emma Foley <emma.l.foley@intel.com> | 2017-11-29 23:34:15 +0000 |
---|---|---|
committer | Ross Brattain <ross.b.brattain@intel.com> | 2018-01-11 15:08:25 -0800 |
commit | d579e62b431a31856a03098dc5323948ccfa4fdb (patch) | |
tree | 3e4be0cc3da237e4697b37809b41fcc357836136 | |
parent | b9f759e9c1be95b66a18927456d112866c5a54bf (diff) |
Move tests: unit/common
* Fix pylint errors
* Add TODOs
Some errors are ignored locally, as they were a symptom of other problems.
These issues have been flagged with a TODO, and should be fixed later.
JIRA: YARDSTICK-837
Change-Id: I2847c380556985fae2c92bb8a7da9c47e91e1338
Signed-off-by: Emma Foley <emma.l.foley@intel.com>
-rw-r--r-- | yardstick/tests/unit/common/__init__.py (renamed from tests/unit/common/__init__.py) | 0 | ||||
-rw-r--r-- | yardstick/tests/unit/common/config_sample.yaml (renamed from tests/unit/common/config_sample.yaml) | 0 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_ansible_common.py (renamed from tests/unit/common/test_ansible_common.py) | 12 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_httpClient.py (renamed from tests/unit/common/test_httpClient.py) | 0 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_openstack_utils.py (renamed from tests/unit/common/test_openstack_utils.py) | 2 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_process.py (renamed from tests/unit/common/test_process.py) | 0 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_template_format.py (renamed from tests/unit/common/test_template_format.py) | 3 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_utils.py (renamed from tests/unit/common/test_utils.py) | 0 | ||||
-rw-r--r-- | yardstick/tests/unit/common/test_yaml_loader.py (renamed from tests/unit/common/test_yaml_loader.py) | 0 |
9 files changed, 10 insertions, 7 deletions
diff --git a/tests/unit/common/__init__.py b/yardstick/tests/unit/common/__init__.py index e69de29bb..e69de29bb 100644 --- a/tests/unit/common/__init__.py +++ b/yardstick/tests/unit/common/__init__.py diff --git a/tests/unit/common/config_sample.yaml b/yardstick/tests/unit/common/config_sample.yaml index 09218cc79..09218cc79 100644 --- a/tests/unit/common/config_sample.yaml +++ b/yardstick/tests/unit/common/config_sample.yaml diff --git a/tests/unit/common/test_ansible_common.py b/yardstick/tests/unit/common/test_ansible_common.py index 1ef8eee5f..89ea128af 100644 --- a/tests/unit/common/test_ansible_common.py +++ b/yardstick/tests/unit/common/test_ansible_common.py @@ -49,7 +49,7 @@ class OverwriteDictTestCase(unittest.TestCase): class FilenameGeneratorTestCase(unittest.TestCase): @mock.patch('{}.NamedTemporaryFile'.format(PREFIX)) - def test__handle_existing_file(self, mock_tmp): + def test__handle_existing_file(self, _): ansible_common.FileNameGenerator._handle_existing_file("/dev/null") def test_get_generator_from_file(self): @@ -184,7 +184,7 @@ class AnsibleCommonTestCase(unittest.TestCase): self.assertEqual(a.deploy_dir, "d") @mock.patch('{}.open'.format(PREFIX)) - def test__gen_ansible_playbook_file_list(self, mock_open): + def test__gen_ansible_playbook_file_list(self, _): d = tempfile.mkdtemp() try: a = ansible_common.AnsibleCommon({}) @@ -194,7 +194,7 @@ class AnsibleCommonTestCase(unittest.TestCase): @mock.patch('{}.NamedTemporaryFile'.format(PREFIX)) @mock.patch('{}.open'.format(PREFIX)) - def test__gen_ansible_inventory_file(self, mock_open, mock_tmp): + def test__gen_ansible_inventory_file(self, _, __): nodes = [{ "name": "name", "user": "user", "password": "PASS", "role": "role", @@ -213,7 +213,7 @@ class AnsibleCommonTestCase(unittest.TestCase): @mock.patch('{}.NamedTemporaryFile'.format(PREFIX)) @mock.patch('{}.open'.format(PREFIX)) - def test__gen_ansible_playbook_file_list_multiple(self, mock_open, mock_tmp): + def test__gen_ansible_playbook_file_list_multiple(self, _, __): d = tempfile.mkdtemp() try: a = ansible_common.AnsibleCommon({}) @@ -224,7 +224,7 @@ class AnsibleCommonTestCase(unittest.TestCase): @mock.patch('{}.NamedTemporaryFile'.format(PREFIX)) @mock.patch('{}.Popen'.format(PREFIX)) @mock.patch('{}.open'.format(PREFIX)) - def test_do_install_tmp_dir(self, mock_open, mock_popen, mock_tmp): + def test_do_install_tmp_dir(self, _, mock_popen, __): mock_popen.return_value.communicate.return_value = "", "" mock_popen.return_value.wait.return_value = 0 d = tempfile.mkdtemp() @@ -237,7 +237,7 @@ class AnsibleCommonTestCase(unittest.TestCase): @mock.patch('{}.NamedTemporaryFile'.format(PREFIX)) @mock.patch('{}.Popen'.format(PREFIX)) @mock.patch('{}.open'.format(PREFIX)) - def test_execute_ansible_check(self, mock_open, mock_popen, mock_tmp): + def test_execute_ansible_check(self, _, mock_popen, __): mock_popen.return_value.communicate.return_value = "", "" mock_popen.return_value.wait.return_value = 0 d = tempfile.mkdtemp() diff --git a/tests/unit/common/test_httpClient.py b/yardstick/tests/unit/common/test_httpClient.py index eb09d1a52..eb09d1a52 100644 --- a/tests/unit/common/test_httpClient.py +++ b/yardstick/tests/unit/common/test_httpClient.py diff --git a/tests/unit/common/test_openstack_utils.py b/yardstick/tests/unit/common/test_openstack_utils.py index b3dc2d9c4..bf468489e 100644 --- a/tests/unit/common/test_openstack_utils.py +++ b/yardstick/tests/unit/common/test_openstack_utils.py @@ -21,7 +21,7 @@ from yardstick.common import openstack_utils class GetCredentialsTestCase(unittest.TestCase): @mock.patch('yardstick.common.openstack_utils.os') - def test_get_credentials(self, mock_os): + def test_get_credentials(self, _): with mock.patch.dict('os.environ', {'OS_IDENTITY_API_VERSION': '2'}, clear=True): openstack_utils.get_credentials() diff --git a/tests/unit/common/test_process.py b/yardstick/tests/unit/common/test_process.py index 1c6dfec27..1c6dfec27 100644 --- a/tests/unit/common/test_process.py +++ b/yardstick/tests/unit/common/test_process.py diff --git a/tests/unit/common/test_template_format.py b/yardstick/tests/unit/common/test_template_format.py index 2a7d80b4d..44aa80333 100644 --- a/tests/unit/common/test_template_format.py +++ b/yardstick/tests/unit/common/test_template_format.py @@ -24,6 +24,9 @@ class TemplateFormatTestCase(unittest.TestCase): def test_parse_to_value_exception(self): + # TODO(elfoley): Don't hide the error that occurs in + # template_format.parse + # TODO(elfoley): Separate these tests; one per error type with mock.patch.object(yaml, 'load') as yaml_loader: yaml_loader.side_effect = yaml.scanner.ScannerError() self.assertRaises(ValueError, template_format.parse, 'FOOBAR') diff --git a/tests/unit/common/test_utils.py b/yardstick/tests/unit/common/test_utils.py index 452b93a56..452b93a56 100644 --- a/tests/unit/common/test_utils.py +++ b/yardstick/tests/unit/common/test_utils.py diff --git a/tests/unit/common/test_yaml_loader.py b/yardstick/tests/unit/common/test_yaml_loader.py index 90cbb8157..90cbb8157 100644 --- a/tests/unit/common/test_yaml_loader.py +++ b/yardstick/tests/unit/common/test_yaml_loader.py |