Skip to content

Commit

Permalink
Merge pull request #35 from martinRenou/ignore_resource_warning
Browse files Browse the repository at this point in the history
Ignore spurious ResourceWarning in tests when opening the rendered result in the browser on Linux
  • Loading branch information
CAM-Gerlach authored Jan 17, 2022
2 parents ce67c9a + c14d485 commit 2db3ff3
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 2db3ff3

Please sign in to comment.