Skip to content

Commit 5dc2f6d

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 5ef0737 commit 5dc2f6d

8 files changed

Lines changed: 80 additions & 57 deletions

File tree

sphinxcontrib/extras_require/sources.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def _decorator(function: Callable) -> Callable:
116116
if list(signature.parameters.keys()) != self._args:
117117
raise SyntaxError(
118118
"The decorated function must take only the following arguments: "
119-
"'package_root', 'options', 'env', and 'extra'"
119+
"'package_root', 'options', 'env', and 'extra'",
120120
)
121121

122122
self.append((option_name, function, validator))
@@ -162,7 +162,7 @@ def requirements_from_file(
162162
requirements, comments = read_requirements(
163163
requirements_file,
164164
normalize_func=normalize_keep_dot,
165-
)
165+
)
166166

167167
return list(map(str, sorted(combine_requirements(requirements))))
168168

tests/test_directive.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,10 @@
5555
id="complex_url_and_marker",
5656
),
5757
pytest.param(
58-
["name[strange, quux];python_version<'2.7' and "
59-
"platform_version=='2'"],
58+
[
59+
"name[strange, quux];python_version<'2.7' and "
60+
"platform_version=='2'",
61+
],
6062
['name[quux,strange]; python_version < "2.7" and platform_version == "2"'],
6163
id="multiple_markers",
6264
),
@@ -85,7 +87,7 @@
8587
["certifi!=2.0.1,<3.0,>0.1", 'numpy; platform_system != "Darwin"', "pytz<1.2"],
8688
id="complex requirements",
8789
),
88-
]
90+
],
8991
)
9092
def test_validate_requirements(requirements: List[str], valid_requirements: List[str]) -> None:
9193
assert validate_requirements(requirements) == valid_requirements
@@ -100,13 +102,14 @@ def test_validate_requirements(requirements: List[str], valid_requirements: List
100102
['name>=1.x.y; python_version == "2.6"'],
101103
id="with_legacy_version_and_marker",
102104
),
103-
]
105+
],
104106
)
105107
def test_validate_requirements_warning(requirements: List[str], valid_requirements: List[str]) -> None:
106108

107109
# New packaging version
108110
with pytest.raises(
109-
ValueError, match=rf"Invalid requirement .*: Expected end or semicolon \(after version specifier\)"
111+
ValueError,
112+
match=rf"Invalid requirement .*: Expected end or semicolon \(after version specifier\)",
110113
):
111114
validate_requirements(requirements)
112115

@@ -123,7 +126,7 @@ def test_validate_requirements_warning(requirements: List[str], valid_requiremen
123126
["pygame ?=1.2.3"],
124127
["six**1.2.3"],
125128
["urllib3;1.2.4, <*1.2.6"],
126-
]
129+
],
127130
)
128131
def test_validate_requirements_invalid(requirements: List[str]) -> None:
129132
with pytest.raises(ValueError, match="Invalid requirement"):
@@ -155,7 +158,7 @@ def test_scopes(self, scope: str) -> None:
155158
pytest.param(["pip", "wheel", "setuptools"], 's', id="3 requirements"),
156159
pytest.param(["numpy", "scipy"], 's', id="2 requirements"),
157160
pytest.param(["sphinx"], '', id="1 requirement"),
158-
]
161+
],
159162
)
160163
def test_plural(self, requirements: List[str], plural: str) -> None:
161164
assert make_node_content(requirements, "my_package", "the_extra").splitlines()[0] == f"""\
@@ -177,7 +180,7 @@ def test(the_app: Sphinx) -> None:
177180
"pkginfo_demo.html",
178181
"manual_demo.html",
179182
],
180-
indirect=True
183+
indirect=True,
181184
)
182185
def test_output(page: BeautifulSoup, html_regression: HTMLRegressionFixture) -> None:
183186

@@ -231,7 +234,7 @@ def test_no_requirements_demo(
231234
{"flit": True, "setup.cfg": True},
232235
[],
233236
),
234-
]
237+
],
235238
)
236239
def test_directive_multiple_sources(options: Dict[str, bool], content: List[str]) -> None:
237240
with pytest.raises(ValueError, match="Please specify only one source for the extra requirements"):
@@ -244,12 +247,13 @@ def test_directive_multiple_sources(options: Dict[str, bool], content: List[str]
244247

245248

246249
@pytest.mark.parametrize(
247-
"options, content", [
250+
"options, content",
251+
[
248252
({}, []),
249253
({"setup_cfg": True}, []),
250254
({"pkginfo": True}, []),
251255
({"flit": False}, []),
252-
]
256+
],
253257
)
254258
def test_directive_no_sources(options: Dict[str, bool], content: List[str]) -> None:
255259
with pytest.raises(ValueError, match="Please specify a source for the extra requirements"):

tests/test_flag.py

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,33 +5,39 @@
55
from sphinxcontrib.extras_require.sources import flag
66

77

8-
@pytest.mark.parametrize("value", [
9-
'',
10-
' ',
11-
" ",
12-
" ",
13-
" ",
14-
'\t',
15-
'\n',
16-
"\t ",
17-
"\t ",
18-
"\t ",
19-
"\t ",
20-
])
8+
@pytest.mark.parametrize(
9+
"value",
10+
[
11+
'',
12+
' ',
13+
" ",
14+
" ",
15+
" ",
16+
'\t',
17+
'\n',
18+
"\t ",
19+
"\t ",
20+
"\t ",
21+
"\t ",
22+
],
23+
)
2124
def test_flag(value: str) -> None:
2225
assert isinstance(flag(value), bool)
2326
assert flag(value) is True
2427

2528

26-
@pytest.mark.parametrize("value", [
27-
"Hello",
28-
" Hello",
29-
"Foo",
30-
" Foo",
31-
"True",
32-
" True",
33-
"\tFalse",
34-
])
29+
@pytest.mark.parametrize(
30+
"value",
31+
[
32+
"Hello",
33+
" Hello",
34+
"Foo",
35+
" Foo",
36+
"True",
37+
" True",
38+
"\tFalse",
39+
],
40+
)
3541
def test_flag_errors(value: str) -> None:
3642
with pytest.raises(ValueError, match="No argument is allowed; '.*' supplied"):
3743
flag(value)

tests/test_from___pkginfo__.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@ def __init__(self, tmpdir: pathlib.Path):
2222
"requirements, extra, expects",
2323
[
2424
({"extra_c": ["faker", "pytest", "tox"]}, "extra_c", ["faker", "pytest", "tox"]),
25-
({"extra_c": ["faker", "pytest", "tox; python<=3.6"]},
26-
"extra_c", ["faker", "pytest", "tox; python<=3.6"]),
27-
]
25+
(
26+
{"extra_c": ["faker", "pytest", "tox; python<=3.6"]},
27+
"extra_c",
28+
["faker", "pytest", "tox; python<=3.6"],
29+
),
30+
],
2831
)
2932
def test_from___pkginfo__(
3033
tmp_pathplus: PathPlus,

tests/test_from_file.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
["faker", "pytest"],
2828
pytest.warns(UserWarning, match="Ignored invalid requirement 'tox; python<=3.6'"),
2929
),
30-
]
30+
],
3131
)
3232
def test_from_file(
3333
tmp_pathplus: PathPlus,

tests/test_from_flit.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(self, tmpdir: pathlib.Path):
2727
'tox; python_version <= "3.6"',
2828
]
2929
""",
30-
"extra_c", ["faker", "pytest", 'tox; python_version <= "3.6"']
30+
"extra_c",
31+
["faker", "pytest", 'tox; python_version <= "3.6"'],
3132
),
3233
(
3334
"""\
@@ -37,9 +38,10 @@ def __init__(self, tmpdir: pathlib.Path):
3738
]
3839
doc = ["sphinx"]
3940
""",
40-
"test", ["pytest>=2.7.3", "pytest-cov"]
41+
"test",
42+
["pytest>=2.7.3", "pytest-cov"],
4143
),
42-
]
44+
],
4345
)
4446
def test_from_flit(tmp_pathplus: PathPlus, toml: str, extra: str, expects: List[str]) -> None:
4547
pyproject_file = tmp_pathplus / "pyproject.toml"
@@ -51,7 +53,7 @@ def test_from_flit(tmp_pathplus: PathPlus, toml: str, extra: str, expects: List[
5153
5254
5355
[tool.flit.metadata.requires-extra]
54-
{toml}"""
56+
{toml}""",
5557
)
5658

5759
assert requirements_from_flit(
@@ -73,7 +75,8 @@ def test_from_flit(tmp_pathplus: PathPlus, toml: str, extra: str, expects: List[
7375
"tox; python<=3.6",
7476
]
7577
""",
76-
"extra", ["faker", "pytest", "tox; python<=3.6"]
78+
"extra",
79+
["faker", "pytest", "tox; python<=3.6"],
7780
),
7881
(
7982
"""\
@@ -83,9 +86,10 @@ def test_from_flit(tmp_pathplus: PathPlus, toml: str, extra: str, expects: List[
8386
]
8487
doc = ["sphinx"]
8588
""",
86-
"testing", ["pytest >=2.7.3", "pytest-cov"]
89+
"testing",
90+
["pytest >=2.7.3", "pytest-cov"],
8791
),
88-
]
92+
],
8993
)
9094
def test_from_flit_errors(
9195
tmp_pathplus: PathPlus,
@@ -102,7 +106,7 @@ def test_from_flit_errors(
102106
103107
104108
[tool.flit.metadata.requires-extra]
105-
{toml}"""
109+
{toml}""",
106110
)
107111

108112
with pytest.raises(ValueError, match=f"'{extra}' not found in '\\[tool.flit.metadata.requires-extra\\]"):

tests/test_from_pyproject.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ def __init__(self, tmpdir: pathlib.Path):
2727
'tox; python_version <= "3.6"',
2828
]
2929
""",
30-
"extra_c", ["faker", "pytest", 'tox; python_version <= "3.6"']
30+
"extra_c",
31+
["faker", "pytest", 'tox; python_version <= "3.6"'],
3132
),
3233
(
3334
"""\
@@ -37,9 +38,10 @@ def __init__(self, tmpdir: pathlib.Path):
3738
]
3839
doc = ["sphinx"]
3940
""",
40-
"test", ["pytest>=2.7.3", "pytest-cov"]
41+
"test",
42+
["pytest>=2.7.3", "pytest-cov"],
4143
),
42-
]
44+
],
4345
)
4446
def test_from_pyproject(tmp_pathplus: PathPlus, toml: str, extra: str, expects: List[str]) -> None:
4547
pyproject_file = tmp_pathplus / "pyproject.toml"
@@ -66,7 +68,8 @@ def test_from_pyproject(tmp_pathplus: PathPlus, toml: str, extra: str, expects:
6668
"tox; python<=3.6",
6769
]
6870
""",
69-
"extra", ["faker", "pytest", "tox; python<=3.6"]
71+
"extra",
72+
["faker", "pytest", "tox; python<=3.6"],
7073
),
7174
(
7275
"""\
@@ -76,9 +79,10 @@ def test_from_pyproject(tmp_pathplus: PathPlus, toml: str, extra: str, expects:
7679
]
7780
doc = ["sphinx"]
7881
""",
79-
"testing", ["pytest >=2.7.3", "pytest-cov"]
82+
"testing",
83+
["pytest >=2.7.3", "pytest-cov"],
8084
),
81-
]
85+
],
8286
)
8387
def test_from_pyproject_errors(
8488
tmp_pathplus: PathPlus,

tests/test_from_setup_cfg.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ def __init__(self, tmpdir: pathlib.Path):
2727
pytest
2828
tox; python<=3.6
2929
""",
30-
"extra_c", ["faker", "pytest", "tox; python<=3.6"]
30+
"extra_c",
31+
["faker", "pytest", "tox; python<=3.6"],
3132
),
32-
]
33+
],
3334
)
3435
def test_from_setup_cfg(
3536
tmp_pathplus: PathPlus,
@@ -61,9 +62,10 @@ def test_from_setup_cfg(
6162
pytest
6263
tox; python<=3.6
6364
""",
64-
"test", ["faker", "pytest", "tox; python<=3.6"]
65+
"test",
66+
["faker", "pytest", "tox; python<=3.6"],
6567
),
66-
]
68+
],
6769
)
6870
def test_from_setup_cfg_errors(
6971
tmp_pathplus: PathPlus,

0 commit comments

Comments
 (0)