Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/certbot/certbot.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYen Chi Hsuan <yan12125@gmail.com>2017-03-17 23:10:02 +0300
committerPeter Eckersley <pde@users.noreply.github.com>2017-03-17 23:10:02 +0300
commit4cad594b4ba81734c3db3343cc418440de99f06e (patch)
tree95df7a0d04f2c61cf2d7526c7f851071c5e03e3d /letshelp-certbot
parentedcfc49303d4ddd2e69ba6ac6933af01d00e332c (diff)
Python 3 compatibility for all tests (#4358)
Diffstat (limited to 'letshelp-certbot')
-rwxr-xr-xletshelp-certbot/letshelp_certbot/apache.py6
-rw-r--r--letshelp-certbot/letshelp_certbot/apache_test.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/letshelp-certbot/letshelp_certbot/apache.py b/letshelp-certbot/letshelp_certbot/apache.py
index 5752bdab0..2391a30bb 100755
--- a/letshelp-certbot/letshelp_certbot/apache.py
+++ b/letshelp-certbot/letshelp_certbot/apache.py
@@ -15,6 +15,7 @@ import tarfile
import tempfile
import textwrap
+import six
_DESCRIPTION = """
Let's Help is a simple script you can run to help out the Certbot
@@ -69,7 +70,7 @@ def make_and_verify_selection(server_root, temp_dir):
sys.stdout.write("\nIs it safe to submit these files? ")
while True:
- ans = raw_input("(Y)es/(N)o: ").lower()
+ ans = six.moves.input("(Y)es/(N)o: ").lower()
if ans.startswith("y"):
return
elif ans.startswith("n"):
@@ -144,7 +145,8 @@ def safe_config_file(config_file):
return False
proc = subprocess.Popen(["file", config_file],
- stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=True)
file_output, _ = proc.communicate()
if "ASCII" in file_output:
diff --git a/letshelp-certbot/letshelp_certbot/apache_test.py b/letshelp-certbot/letshelp_certbot/apache_test.py
index 0c1b5f2f6..e0656ae05 100644
--- a/letshelp-certbot/letshelp_certbot/apache_test.py
+++ b/letshelp-certbot/letshelp_certbot/apache_test.py
@@ -9,6 +9,8 @@ import tempfile
import unittest
import mock
+# six is used in mock.patch()
+import six # pylint: disable=unused-import
import letshelp_certbot.apache as letshelp_le_apache
@@ -63,7 +65,7 @@ class LetsHelpApacheTest(unittest.TestCase):
def test_make_and_verify_selection(self, mock_copy_config):
mock_copy_config.return_value = (["apache2.conf"], ["apache2"])
- with mock.patch("__builtin__.raw_input") as mock_input:
+ with mock.patch("six.moves.input") as mock_input:
with mock.patch(_MODULE_NAME + ".sys.stdout"):
mock_input.side_effect = ["Yes", "No"]
letshelp_le_apache.make_and_verify_selection("root", "temp")