diff --git a/sphinx/__init__.py b/sphinx/__init__.py index 037e04113..d5fe45bb7 100644 --- a/sphinx/__init__.py +++ b/sphinx/__init__.py @@ -44,6 +44,7 @@ if _in_development: ['git', 'rev-parse', '--short', 'HEAD'], cwd=package_dir, capture_output=True, + check=False, encoding='ascii', errors='surrogateescape', ).stdout: diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index 0cc4882fe..154323bf9 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -211,7 +211,8 @@ def if_graphviz_found(app: SphinxTestApp) -> None: # NoQA: PT004 graphviz_dot = getattr(app.config, 'graphviz_dot', '') try: if graphviz_dot: - subprocess.run([graphviz_dot, '-V'], capture_output=True) # show version + # print the graphviz_dot version, to check that the binary is available + subprocess.run([graphviz_dot, '-V'], capture_output=True, check=False) return except OSError: # No such file or directory pass diff --git a/sphinx/testing/path.py b/sphinx/testing/path.py index 7d889d7b8..49e62ce9e 100644 --- a/sphinx/testing/path.py +++ b/sphinx/testing/path.py @@ -150,7 +150,7 @@ class path(str): os.utime(self, arg) def open(self, mode: str = 'r', **kwargs: Any) -> IO: - return open(self, mode, **kwargs) # noqa: SIM115 + return open(self, mode, **kwargs) # NoQA: SIM115 def write_text(self, text: str, encoding: str = 'utf-8', **kwargs: Any) -> None: """ diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 7032c6583..e927dbe87 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -430,7 +430,7 @@ class TexinfoTranslator(SphinxTranslator): entries = self.node_menus[name] if not entries: return - self.body.append(f'\n{self.escape(self.node_names[name], )}\n\n') + self.body.append(f'\n{self.escape(self.node_names[name])}\n\n') self.add_menu_entries(entries) for subentry in entries: _add_detailed_menu(subentry) diff --git a/tests/test_ext_imgconverter.py b/tests/test_ext_imgconverter.py index 18be70048..73eacbd42 100644 --- a/tests/test_ext_imgconverter.py +++ b/tests/test_ext_imgconverter.py @@ -10,7 +10,8 @@ def _if_converter_found(app): image_converter = getattr(app.config, 'image_converter', '') try: if image_converter: - subprocess.run([image_converter, '-version'], capture_output=True) # show version + # print the image_converter version, to check that the command is available + subprocess.run([image_converter, '-version'], capture_output=True, check=False) return except OSError: # No such file or directory pass diff --git a/tests/test_pycode_ast.py b/tests/test_pycode_ast.py index 5efd0cbfa..3a5977a58 100644 --- a/tests/test_pycode_ast.py +++ b/tests/test_pycode_ast.py @@ -18,7 +18,7 @@ from sphinx.pycode.ast import unparse as ast_unparse ("a and b and c", "a and b and c"), # BoolOp ("b'bytes'", "b'bytes'"), # Bytes ("object()", "object()"), # Call - ("1234", "1234"), # Constant + ("1234", "1234"), # Constant, Num ("{'key1': 'value1', 'key2': 'value2'}", "{'key1': 'value1', 'key2': 'value2'}"), # Dict ("a / b", "a / b"), # Div @@ -34,7 +34,6 @@ from sphinx.pycode.ast import unparse as ast_unparse ("a % b", "a % b"), # Mod ("a * b", "a * b"), # Mult ("sys", "sys"), # Name, NameConstant - ("1234", "1234"), # Num ("not a", "not a"), # Not ("a or b", "a or b"), # Or ("a**b", "a**b"), # Pow