mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Fix all BytesWarning identified through tests
Code should not arbitrarily mix bytes & str values. The values should be understood and deliberate. When Python is run with the -b option, this change fixes warnings of the form: BytesWarning: str() on a bytes instance
This commit is contained in:
parent
45ad2e41a5
commit
41ad0d5347
@ -456,7 +456,7 @@ class StandaloneHTMLBuilder(Builder):
|
||||
"""Utility: Render a lone doctree node."""
|
||||
if node is None:
|
||||
return {'fragment': ''}
|
||||
doc = new_document(b'<partial node>')
|
||||
doc = new_document('<partial node>')
|
||||
doc.append(node)
|
||||
|
||||
if self._publisher is None:
|
||||
|
@ -54,8 +54,8 @@ def setup_command(request, tempdir, rootdir):
|
||||
def test_build_sphinx(setup_command):
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode == 0
|
||||
|
||||
|
||||
@ -63,8 +63,8 @@ def test_build_sphinx(setup_command):
|
||||
def test_build_sphinx_multiple_builders(setup_command):
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode == 0
|
||||
|
||||
|
||||
@ -72,8 +72,8 @@ def test_build_sphinx_multiple_builders(setup_command):
|
||||
def test_build_sphinx_multiple_invalid_builders(setup_command):
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode == 1
|
||||
|
||||
|
||||
@ -106,8 +106,8 @@ def nonascii_srcdir(request, setup_command):
|
||||
def test_build_sphinx_with_nonascii_path(setup_command):
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode == 0
|
||||
|
||||
|
||||
@ -118,8 +118,8 @@ def test_build_sphinx_return_nonzero_status(setup_command):
|
||||
'http://localhost.unexistentdomain/index.html')
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode != 0, 'expect non-zero status for setup.py'
|
||||
|
||||
|
||||
@ -129,8 +129,8 @@ def test_build_sphinx_warning_return_zero_status(setup_command):
|
||||
'See :ref:`unexisting-reference-label`')
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode == 0
|
||||
|
||||
|
||||
@ -141,6 +141,6 @@ def test_build_sphinx_warning_is_error_return_nonzero_status(setup_command):
|
||||
'See :ref:`unexisting-reference-label`')
|
||||
proc = setup_command.proc
|
||||
out, err = proc.communicate()
|
||||
print(out)
|
||||
print(err)
|
||||
print(out.decode())
|
||||
print(err.decode())
|
||||
assert proc.returncode != 0, 'expect non-zero status for setup.py'
|
||||
|
Loading…
Reference in New Issue
Block a user