Skip to content

Commit 80a42e4

Browse files
committed
Fixes for open_graphical_browser, fixes #754
1 parent aec9b91 commit 80a42e4

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tests/system/utils/test_main.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
# -*- coding: utf-8 -*-
22

3+
import sys
34
import logging
45

56
import click_log
6-
77
import pytest
8-
98
import requests
109

1110
from vdirsyncer import http, utils
@@ -64,9 +63,12 @@ def test_request_ssl_fingerprints(httpsserver, fingerprint):
6463

6564
def test_open_graphical_browser(monkeypatch):
6665
import webbrowser
67-
# Just assert that this internal attribute still exists and is some sort of
68-
# collection.
69-
iter(webbrowser._tryorder)
66+
# Just assert that this internal attribute still exists and behaves the way
67+
# expected
68+
if sys.version_info < (3, 7):
69+
iter(webbrowser._tryorder)
70+
else:
71+
assert webbrowser._tryorder is None
7072

7173
monkeypatch.setattr('webbrowser._tryorder', [])
7274

vdirsyncer/utils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,9 @@ def open_graphical_browser(url, new=0, autoraise=True):
215215
cli_names = set(['www-browser', 'links', 'links2', 'elinks', 'lynx',
216216
'w3m'])
217217

218+
if webbrowser._tryorder is None: # Python 3.7
219+
webbrowser.register_standard_browsers()
220+
218221
for name in webbrowser._tryorder:
219222
if name in cli_names:
220223
continue

0 commit comments

Comments
 (0)