From cf1415ac1d6656d9ee4ca2f8df81b9005b0d303a Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 27 Dec 2016 22:11:21 -0800 Subject: [PATCH 1/2] Ignore OSX $DISPLAY variable, default to true. #166 --- rtv/terminal.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/rtv/terminal.py b/rtv/terminal.py index d2b6b0c..28668d2 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -93,15 +93,11 @@ class Terminal(object): if self._display is None: if sys.platform == 'darwin': - # OSX doesn't always set DISPLAY so we can't use this to check - # Note: Disabling for now, with the hope that if this - # is a widespread issue then people will complain and we can - # come up with a better solution. Checking for $DISPLAY is - # used extensively in mailcap files, so it really *should* be - # set properly. I don't have a mac anymore so I can't test. - - # display = True - display = bool(os.environ.get("DISPLAY")) + # OS X won't set $DISPLAY unless xQuartz is installed. + # If you're using OS X and you want to access a terminal + # browser, you need to set it manually via $BROWSER. + # See issue #166 + display = True else: display = bool(os.environ.get("DISPLAY")) From c48c0cfe8969b1a59f2a57336ab901fa1ab42d2f Mon Sep 17 00:00:00 2001 From: Michael Lazar Date: Tue, 27 Dec 2016 22:14:41 -0800 Subject: [PATCH 2/2] Fixed test. --- tests/test_terminal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_terminal.py b/tests/test_terminal.py index 06a937f..e4b0249 100644 --- a/tests/test_terminal.py +++ b/tests/test_terminal.py @@ -38,7 +38,7 @@ def test_terminal_properties(terminal, config): with mock.patch('rtv.terminal.sys') as sys, \ mock.patch.dict('os.environ', {'DISPLAY': ''}): sys.platform = 'darwin' - assert terminal.display is False + assert terminal.display is True terminal._display = None with mock.patch.dict('os.environ', {'DISPLAY': ':0', 'BROWSER': 'w3m'}):