diff options
| author | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-02-17 23:46:31 +0000 |
|---|---|---|
| committer | Adam Turner <9087854+aa-turner@users.noreply.github.com> | 2023-02-18 02:16:50 +0000 |
| commit | 13442f690183cc2fb724c51af2321164b5ba749d (patch) | |
| tree | 724024a1ad4d96fc3e22d3a180ee38a37efc0a3c /sphinx | |
| parent | dc1a519a1d76c8fb18500b2093c07fa26c999333 (diff) | |
| download | sphinx-git-13442f690183cc2fb724c51af2321164b5ba749d.tar.gz | |
Fix pytest style issues
Diffstat (limited to 'sphinx')
| -rw-r--r-- | sphinx/ext/apidoc.py | 3 | ||||
| -rw-r--r-- | sphinx/testing/fixtures.py | 4 | ||||
| -rw-r--r-- | sphinx/writers/_html4.py | 2 | ||||
| -rw-r--r-- | sphinx/writers/html5.py | 2 | ||||
| -rw-r--r-- | sphinx/writers/texinfo.py | 2 |
5 files changed, 7 insertions, 6 deletions
diff --git a/sphinx/ext/apidoc.py b/sphinx/ext/apidoc.py index 839486d55..578b54903 100644 --- a/sphinx/ext/apidoc.py +++ b/sphinx/ext/apidoc.py @@ -270,7 +270,8 @@ def recurse_tree(rootpath: str, excludes: list[str], opts: Any, toplevels.append(module_join(root_package, subpackage)) else: # if we are at the root level, we don't require it to be a package - assert root == rootpath and root_package is None + assert root == rootpath + assert root_package is None for py_file in files: if not is_skipped_module(path.join(rootpath, py_file), opts, excludes): module = py_file.split('.')[0] diff --git a/sphinx/testing/fixtures.py b/sphinx/testing/fixtures.py index 8e6fe36b3..710cadcd8 100644 --- a/sphinx/testing/fixtures.py +++ b/sphinx/testing/fixtures.py @@ -198,7 +198,7 @@ def _shared_result_cache() -> None: @pytest.fixture() -def if_graphviz_found(app: SphinxTestApp) -> None: +def if_graphviz_found(app: SphinxTestApp) -> None: # NoQA: PT004 """ The test will be skipped when using 'if_graphviz_found' fixture and graphviz dot command is not found. @@ -233,7 +233,7 @@ def tempdir(tmpdir: str) -> util.path: @pytest.fixture() -def rollback_sysmodules(): +def rollback_sysmodules(): # NoQA: PT004 """ Rollback sys.modules to its value before testing to unload modules during tests. diff --git a/sphinx/writers/_html4.py b/sphinx/writers/_html4.py index 927309fca..0b670bf99 100644 --- a/sphinx/writers/_html4.py +++ b/sphinx/writers/_html4.py @@ -215,7 +215,7 @@ class HTML4Translator(SphinxTranslator, BaseTranslator): 'References must have "refuri" or "refid" attribute.' atts['href'] = '#' + node['refid'] if not isinstance(node.parent, nodes.TextElement): - assert len(node) == 1 and isinstance(node[0], nodes.image) + assert len(node) == 1 and isinstance(node[0], nodes.image) # NoQA: PT018 atts['class'] += ' image-reference' if 'reftitle' in node: atts['title'] = node['reftitle'] diff --git a/sphinx/writers/html5.py b/sphinx/writers/html5.py index afd873908..ab26bab1e 100644 --- a/sphinx/writers/html5.py +++ b/sphinx/writers/html5.py @@ -221,7 +221,7 @@ class HTML5Translator(SphinxTranslator, BaseTranslator): 'References must have "refuri" or "refid" attribute.' atts['href'] = '#' + node['refid'] if not isinstance(node.parent, nodes.TextElement): - assert len(node) == 1 and isinstance(node[0], nodes.image) + assert len(node) == 1 and isinstance(node[0], nodes.image) # NoQA: PT018 atts['class'] += ' image-reference' if 'reftitle' in node: atts['title'] = node['reftitle'] diff --git a/sphinx/writers/texinfo.py b/sphinx/writers/texinfo.py index 22817b03c..087f13665 100644 --- a/sphinx/writers/texinfo.py +++ b/sphinx/writers/texinfo.py @@ -286,7 +286,7 @@ class TexinfoTranslator(SphinxTranslator): targets: list[Element] = [self.document] targets.extend(self.document.findall(nodes.section)) for node in targets: - assert 'node_name' in node and node['node_name'] + assert 'node_name' in node and node['node_name'] # NoQA: PT018 entries = [s['node_name'] for s in find_subsections(node)] node_menus[node['node_name']] = entries # try to find a suitable "Top" node |
