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)
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)