mirror of
https://github.com/samsonjs/vdirsyncer.git
synced 2026-04-27 14:57:41 +00:00
Fixes for open_graphical_browser, fixes #754
This commit is contained in:
parent
aec9b91602
commit
80a42e4c6c
2 changed files with 10 additions and 5 deletions
|
|
@ -1,11 +1,10 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
import click_log
|
import click_log
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
from vdirsyncer import http, utils
|
from vdirsyncer import http, utils
|
||||||
|
|
@ -64,9 +63,12 @@ def test_request_ssl_fingerprints(httpsserver, fingerprint):
|
||||||
|
|
||||||
def test_open_graphical_browser(monkeypatch):
|
def test_open_graphical_browser(monkeypatch):
|
||||||
import webbrowser
|
import webbrowser
|
||||||
# Just assert that this internal attribute still exists and is some sort of
|
# Just assert that this internal attribute still exists and behaves the way
|
||||||
# collection.
|
# expected
|
||||||
iter(webbrowser._tryorder)
|
if sys.version_info < (3, 7):
|
||||||
|
iter(webbrowser._tryorder)
|
||||||
|
else:
|
||||||
|
assert webbrowser._tryorder is None
|
||||||
|
|
||||||
monkeypatch.setattr('webbrowser._tryorder', [])
|
monkeypatch.setattr('webbrowser._tryorder', [])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,9 @@ def open_graphical_browser(url, new=0, autoraise=True):
|
||||||
cli_names = set(['www-browser', 'links', 'links2', 'elinks', 'lynx',
|
cli_names = set(['www-browser', 'links', 'links2', 'elinks', 'lynx',
|
||||||
'w3m'])
|
'w3m'])
|
||||||
|
|
||||||
|
if webbrowser._tryorder is None: # Python 3.7
|
||||||
|
webbrowser.register_standard_browsers()
|
||||||
|
|
||||||
for name in webbrowser._tryorder:
|
for name in webbrowser._tryorder:
|
||||||
if name in cli_names:
|
if name in cli_names:
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue