diff --git a/jenkins_jobs/utils.py b/jenkins_jobs/utils.py index 4e28ad25d..385f87ba6 100644 --- a/jenkins_jobs/utils.py +++ b/jenkins_jobs/utils.py @@ -19,6 +19,7 @@ import codecs import fnmatch import locale import os.path +from six.moves import input def wrap_stream(stream, encoding='utf-8'): diff --git a/tests/cmd/subcommands/test_delete_all.py b/tests/cmd/subcommands/test_delete_all.py index 15fc23dda..392649941 100644 --- a/tests/cmd/subcommands/test_delete_all.py +++ b/tests/cmd/subcommands/test_delete_all.py @@ -17,8 +17,6 @@ # of actions by the JJB library, usually through interaction with the # python-jenkins library. -import six - from tests.base import mock from tests.cmd.test_cmd import CmdTestsBase @@ -27,8 +25,6 @@ from tests.cmd.test_cmd import CmdTestsBase mock.MagicMock) class DeleteAllTests(CmdTestsBase): - input_module = "jenkins_jobs.utils" if six.PY2 else "builtins" - @mock.patch('jenkins_jobs.cli.subcommand.update.' 'JenkinsManager.delete_all_jobs') def test_delete_all_accept(self, delete_job_mock): @@ -37,7 +33,7 @@ class DeleteAllTests(CmdTestsBase): """ args = ['--conf', self.default_config_file, 'delete-all'] - with mock.patch('%s.input' % self.input_module, return_value="y"): + with mock.patch('jenkins_jobs.utils.input', return_value="y"): self.execute_jenkins_jobs_with_args(args) @mock.patch('jenkins_jobs.cli.subcommand.update.' @@ -48,6 +44,6 @@ class DeleteAllTests(CmdTestsBase): """ args = ['--conf', self.default_config_file, 'delete-all'] - with mock.patch('%s.input' % self.input_module, return_value="n"): + with mock.patch('jenkins_jobs.utils.input', return_value="n"): self.assertRaises(SystemExit, self.execute_jenkins_jobs_with_args, args)