Move tests: unit/common 55/48255/8
authorEmma Foley <emma.l.foley@intel.com>
Wed, 29 Nov 2017 23:34:15 +0000 (23:34 +0000)
committerRoss Brattain <ross.b.brattain@intel.com>
Thu, 11 Jan 2018 23:08:25 +0000 (15:08 -0800)
* 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>
yardstick/tests/unit/common/__init__.py [moved from tests/unit/common/__init__.py with 100% similarity]
yardstick/tests/unit/common/config_sample.yaml [moved from tests/unit/common/config_sample.yaml with 100% similarity]
yardstick/tests/unit/common/test_ansible_common.py [moved from tests/unit/common/test_ansible_common.py with 95% similarity]
yardstick/tests/unit/common/test_httpClient.py [moved from tests/unit/common/test_httpClient.py with 100% similarity]
yardstick/tests/unit/common/test_openstack_utils.py [moved from tests/unit/common/test_openstack_utils.py with 96% similarity]
yardstick/tests/unit/common/test_process.py [moved from tests/unit/common/test_process.py with 100% similarity]
yardstick/tests/unit/common/test_template_format.py [moved from tests/unit/common/test_template_format.py with 91% similarity]
yardstick/tests/unit/common/test_utils.py [moved from tests/unit/common/test_utils.py with 100% similarity]
yardstick/tests/unit/common/test_yaml_loader.py [moved from tests/unit/common/test_yaml_loader.py with 100% similarity]

@@ -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()
@@ -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()
@@ -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')