mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
[tests] correctly intercept or suppress warnings in tests (#12085)
This commit is contained in:
parent
d6f49f9c09
commit
dbb4da375f
@ -225,6 +225,8 @@ empty_parameter_set_mark = "xfail"
|
||||
filterwarnings = [
|
||||
"all",
|
||||
"ignore::DeprecationWarning:docutils.io",
|
||||
"ignore:Distutils was imported before Setuptools:UserWarning:_distutils_hack",
|
||||
"ignore:Setuptools is replacing distutils:UserWarning:_distutils_hack",
|
||||
"ignore::DeprecationWarning:pyximport.pyximport",
|
||||
"ignore::ImportWarning:importlib._bootstrap",
|
||||
]
|
||||
|
@ -6,6 +6,7 @@ import re
|
||||
import pytest
|
||||
|
||||
from sphinx.builders.html import validate_html_extra_path, validate_html_static_path
|
||||
from sphinx.deprecation import RemovedInSphinx80Warning
|
||||
from sphinx.errors import ConfigError
|
||||
from sphinx.util.inventory import InventoryFile
|
||||
|
||||
@ -341,7 +342,8 @@ def test_validate_html_extra_path(app):
|
||||
app.outdir, # outdir
|
||||
app.outdir / '_static', # inside outdir
|
||||
]
|
||||
validate_html_extra_path(app, app.config)
|
||||
with pytest.warns(RemovedInSphinx80Warning, match='Use "pathlib.Path" or "os.fspath" instead'):
|
||||
validate_html_extra_path(app, app.config)
|
||||
assert app.config.html_extra_path == ['_static']
|
||||
|
||||
|
||||
@ -354,7 +356,8 @@ def test_validate_html_static_path(app):
|
||||
app.outdir, # outdir
|
||||
app.outdir / '_static', # inside outdir
|
||||
]
|
||||
validate_html_static_path(app, app.config)
|
||||
with pytest.warns(RemovedInSphinx80Warning, match='Use "pathlib.Path" or "os.fspath" instead'):
|
||||
validate_html_static_path(app, app.config)
|
||||
assert app.config.html_static_path == ['_static']
|
||||
|
||||
|
||||
|
@ -24,6 +24,7 @@ from sphinx.builders.linkcheck import (
|
||||
HyperlinkAvailabilityCheckWorker,
|
||||
RateLimit,
|
||||
)
|
||||
from sphinx.deprecation import RemovedInSphinx80Warning
|
||||
from sphinx.testing.util import strip_escseq
|
||||
from sphinx.util import requests
|
||||
|
||||
@ -413,7 +414,10 @@ def test_unauthorized_broken(app):
|
||||
'linkcheck', testroot='linkcheck-localserver', freshenv=True,
|
||||
confoverrides={'linkcheck_auth': [(r'^$', ('user1', 'password'))]})
|
||||
def test_auth_header_no_match(app):
|
||||
with http_server(custom_handler(valid_credentials=("user1", "password"))):
|
||||
with (
|
||||
http_server(custom_handler(valid_credentials=("user1", "password"))),
|
||||
pytest.warns(RemovedInSphinx80Warning, match='linkcheck builder encountered an HTTP 401'),
|
||||
):
|
||||
app.build()
|
||||
|
||||
with open(app.outdir / "output.json", encoding="utf-8") as fp:
|
||||
|
Loading…
Reference in New Issue
Block a user