Skip to content

Commit

Permalink
Ignore spurious ResourceWarning in tests
Browse files Browse the repository at this point in the history
This fixes the test when using the --open-browser option on Linux
  • Loading branch information
martinRenou committed Jan 17, 2022
1 parent ce67c9a commit c14d485
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Setup for Pytest."""

# Standard library imports
import warnings
import webbrowser

# Third party imports
Expand Down Expand Up @@ -31,5 +32,8 @@ def open_browser(request):
"""Show the passed URL in the user's web browser if passed."""
def _open_browser(url):
if request.config.getoption(OPEN_BROWSER_OPTION):
warnings.filterwarnings(
'ignore', category=ResourceWarning, module='subprocess.*')

webbrowser.open_new_tab(url)
return _open_browser

0 comments on commit c14d485

Please sign in to comment.