refactoring: Drop PY2 and PY3 flags

This commit is contained in:
Takeshi KOMIYA
2018-09-08 10:52:24 +09:00
parent 5ffce30d75
commit 3a2418a827
28 changed files with 228 additions and 522 deletions

View File

@@ -13,7 +13,7 @@ import sys
import time
import pytest
from six import PY2, text_type, StringIO
from six import text_type, StringIO
from six.moves import input
from sphinx import application
@@ -37,12 +37,7 @@ def mock_input(answers, needanswer=False):
raise AssertionError('answer for %r missing and no default '
'present' % prompt)
called.add(prompt)
if PY2:
prompt = str(prompt) # Python2.x raw_input emulation
# `raw_input` encode `prompt` by default encoding to print.
else:
prompt = text_type(prompt) # Python3.x input emulation
# `input` decode prompt by default encoding before print.
prompt = text_type(prompt)
for question in answers:
if prompt.startswith(qs.PROMPT_PREFIX + question):
return answers[question]