diff options
author | Troy Dawson <tdawson@redhat.com> | 2015-10-27 10:41:33 -0500 |
---|---|---|
committer | Troy Dawson <tdawson@redhat.com> | 2015-10-27 10:41:33 -0500 |
commit | e5a8e1589774130c59b166419543709f40a6766e (patch) | |
tree | 2dd4259d88566af132b131c15ff89dda3cc74e55 /utils/test | |
parent | df78d323c0643fa5c7f04e20de2ff55776218df4 (diff) | |
parent | 690e5c955697fad2be8742e5a581f1e2a39d17b0 (diff) | |
download | openshift-e5a8e1589774130c59b166419543709f40a6766e.tar.gz openshift-e5a8e1589774130c59b166419543709f40a6766e.tar.bz2 openshift-e5a8e1589774130c59b166419543709f40a6766e.tar.xz openshift-e5a8e1589774130c59b166419543709f40a6766e.zip |
Merge pull request #1 from dgoodwin/pep8
Pylint fixes and ignores for incoming oo-install code.
Diffstat (limited to 'utils/test')
-rw-r--r-- | utils/test/cli_installer_tests.py | 26 | ||||
-rw-r--r-- | utils/test/oo_config_tests.py | 12 |
2 files changed, 25 insertions, 13 deletions
diff --git a/utils/test/cli_installer_tests.py b/utils/test/cli_installer_tests.py index 78e3ab3bf..076fe5dc9 100644 --- a/utils/test/cli_installer_tests.py +++ b/utils/test/cli_installer_tests.py @@ -1,4 +1,7 @@ -import sys +# TODO: Temporarily disabled due to importing old code into openshift-ansible +# repo. We will work on these over time. +# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name + import copy import os import ConfigParser @@ -7,7 +10,7 @@ import yaml import ooinstall.cli_installer as cli from click.testing import CliRunner -from oo_config_tests import OOInstallFixture +from test.oo_config_tests import OOInstallFixture from mock import patch @@ -77,14 +80,14 @@ class OOCliFixture(OOInstallFixture): def assert_result(self, result, exit_code): if result.exception is not None or result.exit_code != exit_code: - print("Unexpected result from CLI execution") - print("Exit code: %s" % result.exit_code) - print("Exception: %s" % result.exception) + print "Unexpected result from CLI execution" + print "Exit code: %s" % result.exit_code + print "Exception: %s" % result.exception print result.exc_info import traceback traceback.print_exception(*result.exc_info) - print("Output:\n%s" % result.output) - self.assertTrue("Exception during CLI execution", False) + print "Output:\n%s" % result.output + self.fail("Exception during CLI execution") def _read_yaml(self, config_file_path): f = open(config_file_path, 'r') @@ -261,6 +264,9 @@ class UnattendedCliTests(OOCliFixture): self._ansible_config_test(load_facts_mock, run_ansible_mock, config, None, ansible_config) + #pylint: disable=too-many-arguments + # This method allows for drastically simpler tests to write, and the args + # are all useful. def _ansible_config_test(self, load_facts_mock, run_ansible_mock, installer_config, ansible_config_cli=None, expected_result=None): """ @@ -287,7 +293,7 @@ class UnattendedCliTests(OOCliFixture): self.assertFalse('ANSIBLE_CONFIG' in facts_env_vars) # Test the env vars for main playbook: - playbook, inventory, env_vars = run_ansible_mock.call_args[0] + env_vars = run_ansible_mock.call_args[0][2] if expected_result: self.assertEquals(expected_result, env_vars['ANSIBLE_CONFIG']) else: @@ -302,7 +308,9 @@ class AttendedCliTests(OOCliFixture): self.config_file = os.path.join(self.work_dir, 'config.yml') self.cli_args.extend(["-c", self.config_file]) - def _build_input(self, ssh_user=None, hosts=None, variant_num=None, add_nodes=None, confirm_facts=None): + #pylint: disable=too-many-arguments + def _build_input(self, ssh_user=None, hosts=None, variant_num=None, + add_nodes=None, confirm_facts=None): """ Builds a CLI input string with newline characters to simulate the full run. diff --git a/utils/test/oo_config_tests.py b/utils/test/oo_config_tests.py index 8459b7c39..01af33fd9 100644 --- a/utils/test/oo_config_tests.py +++ b/utils/test/oo_config_tests.py @@ -1,3 +1,7 @@ +# TODO: Temporarily disabled due to importing old code into openshift-ansible +# repo. We will work on these over time. +# pylint: disable=bad-continuation,missing-docstring,no-self-use,invalid-name + import os import unittest import tempfile @@ -64,9 +68,9 @@ class OOInstallFixture(unittest.TestCase): up in teardown. Returns full path to the file. """ - f = open(path, 'w') - f.write(config_str) - f.close() + cfg_file = open(path, 'w') + cfg_file.write(config_str) + cfg_file.close() return path @@ -88,7 +92,7 @@ class OOConfigTests(OOInstallFixture): self.assertEquals('openshift-enterprise', ooconfig.settings['variant']) - def test_load_complete_validated_facts(self): + def test_load_complete_facts(self): cfg_path = self.write_config(os.path.join(self.work_dir, 'ooinstall.conf'), SAMPLE_CONFIG) ooconfig = OOConfig(cfg_path) |