Fixed a few python2 tests.
This commit is contained in:
@@ -52,8 +52,11 @@ class Terminal(object):
|
|||||||
self.loader = LoadScreen(self)
|
self.loader = LoadScreen(self)
|
||||||
self._display = None
|
self._display = None
|
||||||
|
|
||||||
# TODO: Load from custom location
|
try:
|
||||||
self._mailcap_dict = mailcap.getcaps()
|
self._mailcap_dict = mailcap.getcaps()
|
||||||
|
except IOError:
|
||||||
|
# Python 2 raises an error, python 3 does not
|
||||||
|
self._mailcap_dict = {}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def up_arrow(self):
|
def up_arrow(self):
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ def test_objects_load_screen_exception_handled(terminal, stdscr, use_ascii):
|
|||||||
assert not terminal.loader._is_running
|
assert not terminal.loader._is_running
|
||||||
assert not terminal.loader._animator.is_alive()
|
assert not terminal.loader._animator.is_alive()
|
||||||
assert isinstance(terminal.loader.exception, requests.ConnectionError)
|
assert isinstance(terminal.loader.exception, requests.ConnectionError)
|
||||||
error_message = 'ConnectionError'.encode('ascii' if ascii else 'utf-8')
|
error_message = 'ConnectionError'.encode('ascii' if use_ascii else 'utf-8')
|
||||||
stdscr.subwin.addstr.assert_called_with(1, 1, error_message)
|
stdscr.subwin.addstr.assert_called_with(1, 1, error_message)
|
||||||
|
|
||||||
|
|
||||||
@@ -155,7 +155,7 @@ def test_objects_load_screen_nested_complex(terminal, stdscr, use_ascii):
|
|||||||
assert terminal.loader.depth == 0
|
assert terminal.loader.depth == 0
|
||||||
assert not terminal.loader._is_running
|
assert not terminal.loader._is_running
|
||||||
assert not terminal.loader._animator.is_alive()
|
assert not terminal.loader._animator.is_alive()
|
||||||
error_message = 'ConnectionError'.encode('ascii' if ascii else 'utf-8')
|
error_message = 'ConnectionError'.encode('ascii' if use_ascii else 'utf-8')
|
||||||
stdscr.subwin.addstr.assert_called_once_with(1, 1, error_message)
|
stdscr.subwin.addstr.assert_called_once_with(1, 1, error_message)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -154,7 +154,7 @@ def test_terminal_clean_unescape_html(terminal, use_ascii):
|
|||||||
terminal.config['ascii'] = use_ascii
|
terminal.config['ascii'] = use_ascii
|
||||||
text = terminal.clean('<')
|
text = terminal.clean('<')
|
||||||
assert isinstance(text, six.binary_type)
|
assert isinstance(text, six.binary_type)
|
||||||
assert text.decode('ascii' if ascii else 'utf-8') == '<'
|
assert text.decode('ascii' if use_ascii else 'utf-8') == '<'
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.parametrize('use_ascii', [True, False])
|
@pytest.mark.parametrize('use_ascii', [True, False])
|
||||||
|
|||||||
Reference in New Issue
Block a user