mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix B904 (raise exceptions with `raise ... from ...`)
This commit is contained in:
@@ -385,7 +385,7 @@ def test_run_epubcheck(app):
|
||||
except CalledProcessError as exc:
|
||||
print(exc.stdout.decode('utf-8'))
|
||||
print(exc.stderr.decode('utf-8'))
|
||||
raise AssertionError('epubcheck exited with return code %s' % exc.returncode)
|
||||
raise AssertionError(f'epubcheck exited with return code {exc.returncode}') from exc
|
||||
|
||||
|
||||
def test_xml_name_pattern_check():
|
||||
|
||||
@@ -74,7 +74,7 @@ def test_msgfmt(app):
|
||||
except CalledProcessError as exc:
|
||||
print(exc.stdout)
|
||||
print(exc.stderr)
|
||||
raise AssertionError('msginit exited with return code %s' % exc.returncode)
|
||||
raise AssertionError(f'msginit exited with return code {exc.returncode}') from exc
|
||||
|
||||
assert (app.outdir / 'en_US.po').is_file(), 'msginit failed'
|
||||
try:
|
||||
@@ -86,7 +86,7 @@ def test_msgfmt(app):
|
||||
except CalledProcessError as exc:
|
||||
print(exc.stdout)
|
||||
print(exc.stderr)
|
||||
raise AssertionError('msgfmt exited with return code %s' % exc.returncode)
|
||||
raise AssertionError(f'msgfmt exited with return code {exc.returncode}') from exc
|
||||
|
||||
mo = app.outdir / 'en' / 'LC_MESSAGES' / 'test_root.mo'
|
||||
assert mo.is_file(), 'msgfmt failed'
|
||||
|
||||
@@ -73,7 +73,7 @@ def compile_latex_document(app, filename='python.tex', docclass='manual'):
|
||||
print(exc.stdout.decode('utf8'))
|
||||
print(exc.stderr.decode('utf8'))
|
||||
raise AssertionError(f'{app.config.latex_engine} exited with '
|
||||
f'return code {exc.returncode}')
|
||||
f'return code {exc.returncode}') from exc
|
||||
|
||||
|
||||
def skip_if_requested(testfunc):
|
||||
|
||||
@@ -56,7 +56,7 @@ def test_texinfo(app, status, warning):
|
||||
except CalledProcessError as exc:
|
||||
print(exc.stdout)
|
||||
print(exc.stderr)
|
||||
raise AssertionError('makeinfo exited with return code %s' % exc.retcode)
|
||||
raise AssertionError(f'makeinfo exited with return code {exc.retcode}') from exc
|
||||
|
||||
|
||||
@pytest.mark.sphinx('texinfo', testroot='markup-rubric')
|
||||
|
||||
Reference in New Issue
Block a user