Skip to content

Commit d9b4d24

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

File tree

4 files changed

+35
-21
lines changed

4 files changed

+35
-21
lines changed

src/setuptools_scm/_entrypoints.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,11 @@ def _call_version_scheme(
118118
if result is not None:
119119
return result
120120
if not found_any_implementation:
121-
raise ValueError(f'Couldn\'t find any implementations for entrypoint "{entrypoint}" with value "{given_value}".')
121+
raise ValueError(
122+
f'Couldn\'t find any implementations for entrypoint "{entrypoint}" with value "{given_value}".'
123+
)
122124
if default is not None:
123125
return default
124-
raise ValueError(f'None of the "{entrypoint}" entrypoints matching "{given_value}" returned a value.')
126+
raise ValueError(
127+
f'None of the "{entrypoint}" entrypoints matching "{given_value}" returned a value.'
128+
)

src/setuptools_scm/version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ def _parse_version_tag(
6868

6969
raise ValueError(
7070
f'The tag_regex "{config.tag_regex.pattern}" matched tag "{tag}", however the matched'
71-
' group has no value.'
71+
" group has no value."
7272
)
7373
else:
7474
log.debug("tag %r did not parse", tag)

testing/test_config.py

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,18 @@ def test_config_overrides(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> No
9898
assert pristine.root != overridden.root
9999
assert pristine.fallback_root != overridden.fallback_root
100100

101+
101102
@pytest.mark.parametrize(
102-
"tag_regex", [
103-
r".*",
104-
r"(.+)(.+)",
105-
r"((.*))",
106-
]
103+
"tag_regex",
104+
[
105+
r".*",
106+
r"(.+)(.+)",
107+
r"((.*))",
108+
],
107109
)
108110
def test_config_bad_regex(tag_regex: str) -> None:
109-
with pytest.raises(ValueError, match=f"Expected tag_regex '{re.escape(tag_regex)}' to contain a single match group or a group named 'version' to identify the version part of any tag."):
111+
with pytest.raises(
112+
ValueError,
113+
match=f"Expected tag_regex '{re.escape(tag_regex)}' to contain a single match group or a group named 'version' to identify the version part of any tag.",
114+
):
110115
Configuration(tag_regex=tag_regex)

testing/test_version.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,13 @@ def test_tag_regex1(tag: str, expected: str) -> None:
190190

191191

192192
def test_regex_match_but_no_version() -> None:
193-
with pytest.raises(ValueError, match=r'The tag_regex "\(\?P<version>\)\.\*" matched tag "v1", however the matched group has no value'):
193+
with pytest.raises(
194+
ValueError,
195+
match=r'The tag_regex "\(\?P<version>\)\.\*" matched tag "v1", however the matched group has no value',
196+
):
194197
meta("v1", config=replace(c, tag_regex="(?P<version>).*"))
195198

199+
196200
@pytest.mark.issue("https://github.com/pypa/setuptools_scm/issues/471")
197201
def test_version_bump_bad() -> None:
198202
class YikesVersion:
@@ -415,22 +419,20 @@ def __repr__(self) -> str:
415419
assert isinstance(scm_version.tag, MyVersion)
416420
assert str(scm_version.tag) == "Custom 1.0.0-foo"
417421

418-
@pytest.mark.parametrize(
419-
"config_key", ["version_scheme", "local_scheme"]
420-
)
422+
423+
@pytest.mark.parametrize("config_key", ["version_scheme", "local_scheme"])
421424
def test_no_matching_entrypoints(config_key: str) -> None:
422425
version = meta(
423426
"1.0",
424-
config=replace(
425-
c,
426-
**{
427-
config_key: "nonexistant"
428-
}
429-
),
427+
config=replace(c, **{config_key: "nonexistant"}),
430428
)
431-
with pytest.raises(ValueError, match=r'Couldn\'t find any implementations for entrypoint "setuptools_scm\..*?" with value "nonexistant"'):
429+
with pytest.raises(
430+
ValueError,
431+
match=r'Couldn\'t find any implementations for entrypoint "setuptools_scm\..*?" with value "nonexistant"',
432+
):
432433
format_version(version)
433434

435+
434436
def test_all_entrypoints_return_none() -> None:
435437
version = meta(
436438
"1.0",
@@ -439,5 +441,8 @@ def test_all_entrypoints_return_none() -> None:
439441
version_scheme=lambda v: None,
440442
),
441443
)
442-
with pytest.raises(ValueError, match=r'None of the "setuptools_scm.version_scheme" entrypoints matching .*? returned a value.'):
444+
with pytest.raises(
445+
ValueError,
446+
match=r'None of the "setuptools_scm.version_scheme" entrypoints matching .*? returned a value.',
447+
):
443448
format_version(version)

0 commit comments

Comments
 (0)