コード例 #1
0
def test_open_graphical_browser(monkeypatch):
    import webbrowser
    # Just assert that this internal attribute still exists and is some sort of
    # collection.
    iter(webbrowser._tryorder)

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

    with pytest.raises(RuntimeError) as excinfo:
        utils.open_graphical_browser('http://example.com')

    assert 'No graphical browser found' in str(excinfo.value)
コード例 #2
0
ファイル: test_main.py プロジェクト: twishmay/vdirsyncer
def test_open_graphical_browser(monkeypatch):
    import webbrowser
    # Just assert that this internal attribute still exists and behaves the way
    # expected
    if sys.version_info < (3, 7):
        iter(webbrowser._tryorder)
    else:
        assert webbrowser._tryorder is None

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

    with pytest.raises(RuntimeError) as excinfo:
        utils.open_graphical_browser('http://example.com')

    assert 'No graphical browser found' in str(excinfo.value)
コード例 #3
0
ファイル: test_main.py プロジェクト: pimutils/vdirsyncer
def test_open_graphical_browser(monkeypatch):
    import webbrowser
    # Just assert that this internal attribute still exists and behaves the way
    # expected
    if sys.version_info < (3, 7):
        iter(webbrowser._tryorder)
    else:
        assert webbrowser._tryorder is None

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

    with pytest.raises(RuntimeError) as excinfo:
        utils.open_graphical_browser('http://example.com')

    assert 'No graphical browser found' in str(excinfo.value)