Skip to content

Commit aeb4ae5

Browse files
committed
Resolve warnings in tests
1 parent eebe9b7 commit aeb4ae5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.github/workflows/test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,10 @@ jobs:
7979
- name: Test with pytest
8080
run: python -m pytest -vv
8181
env:
82-
PYTHONWARNINGS: "error" # treat all warnings as errors
82+
PYTHONWARNINGS: "error,ignore::DeprecationWarning:sphinx.builders.gettext" # treat all warnings as errors
8383
- name: Install social-cards extra
8484
run: uv pip install .[social-cards]
8585
- name: Test with pytest (social-cards)
8686
run: python -m pytest -vv
8787
env:
88-
PYTHONWARNINGS: "error" # treat all warnings as errors
88+
PYTHONWARNINGS: "error,ignore::EncodingWarning:matplotlib.font_manager,ignore::DeprecationWarning:sphinx.builders.gettext" # treat all warnings as errors

tests/conftest.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
import sphinx
77
from bs4 import BeautifulSoup
88

9+
try:
10+
import matplotlib as mpl
11+
except ImportError:
12+
pass
13+
else:
14+
mpl.rcParams['figure.max_open_warning'] = 0
15+
916
pytest_plugins = ['sphinx.testing.fixtures']
1017

1118

@@ -27,9 +34,9 @@ def content(app):
2734

2835
def _meta_tags(content, subdir=None):
2936
if subdir is None:
30-
c = (content.outdir / 'index.html').read_text()
37+
c = (content.outdir / 'index.html').read_text(encoding='utf-8')
3138
else:
32-
c = (content.outdir / subdir / 'index.html').read_text()
39+
c = (content.outdir / subdir / 'index.html').read_text(encoding='utf-8')
3340
return BeautifulSoup(c, 'html.parser').find_all('meta')
3441

3542

0 commit comments

Comments
 (0)