def test_open_docs(): """Test doc launching.""" old_tab = webbrowser.open_new_tab try: # monkey patch temporarily to prevent tabs from actually spawning webbrowser.open_new_tab = myfun open_docs() open_docs('tutorials', 'dev') open_docs('examples', 'stable') pytest.raises(ValueError, open_docs, 'foo') pytest.raises(ValueError, open_docs, 'api', 'foo') finally: webbrowser.open_new_tab = old_tab
def test_open_docs(): """Test doc launching.""" old_tab = webbrowser.open_new_tab try: # monkey patch temporarily to prevent tabs from actually spawning webbrowser.open_new_tab = lambda x: assert_true('martinos' in x) open_docs() open_docs('tutorials', 'dev') open_docs('examples', 'stable') assert_raises(ValueError, open_docs, 'foo') assert_raises(ValueError, open_docs, 'api', 'foo') finally: webbrowser.open_new_tab = old_tab