Skip to content

Commit 1ca55c9

Browse files
authored
Workaround for clash between ruff in pre-commit hook and pytest-ruff (#4705)
2 parents a39336b + c498d16 commit 1ca55c9

File tree

7 files changed

+26
-31
lines changed

7 files changed

+26
-31
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/astral-sh/ruff-pre-commit
3-
rev: v0.5.7
3+
rev: v0.7.1
44
hooks:
55
- id: ruff
66
args: [--fix, --unsafe-fixes]

setuptools/command/alias.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ def finalize_options(self):
3434
option_base.finalize_options(self)
3535
if self.remove and len(self.args) != 1:
3636
raise DistutilsOptionError(
37-
"Must specify exactly one argument (the alias name) when "
38-
"using --remove"
37+
"Must specify exactly one argument (the alias name) when using --remove"
3938
)
4039

4140
def run(self):

setuptools/command/bdist_wheel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ def get_tag(self) -> tuple[str, str, str]:
390390
supported_tags = [
391391
(t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
392392
]
393-
assert (
394-
tag in supported_tags
395-
), f"would build wheel with unsupported tag {tag}"
393+
assert tag in supported_tags, (
394+
f"would build wheel with unsupported tag {tag}"
395+
)
396396
return tag
397397

398398
def run(self):

setuptools/command/install.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,7 @@ def finalize_options(self):
7070
elif self.single_version_externally_managed:
7171
if not self.root and not self.record:
7272
raise DistutilsArgError(
73-
"You must specify --record or --root when building system"
74-
" packages"
73+
"You must specify --record or --root when building system packages"
7574
)
7675

7776
def handle_extra_path(self):

setuptools/tests/config/test_setupcfg.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,7 @@ def test_not_utf8(self, tmpdir):
415415
"""
416416
fake_env(
417417
tmpdir,
418-
'# vim: set fileencoding=iso-8859-15 :\n'
419-
'[metadata]\n'
420-
'description = éàïôñ\n',
418+
'# vim: set fileencoding=iso-8859-15 :\n[metadata]\ndescription = éàïôñ\n',
421419
encoding='iso-8859-15',
422420
)
423421
with pytest.raises(UnicodeDecodeError):

setuptools/tests/test_build_py.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@ def test_recursive_in_package_data_glob(tmpdir_cwd):
5555
dist.parse_command_line()
5656
dist.run_commands()
5757

58-
assert stat.S_ISREG(
59-
os.stat('build/lib/path/subpath/subsubpath/data').st_mode
60-
), "File is not included"
58+
assert stat.S_ISREG(os.stat('build/lib/path/subpath/subsubpath/data').st_mode), (
59+
"File is not included"
60+
)
6161

6262

6363
def test_read_only(tmpdir_cwd):
@@ -116,9 +116,9 @@ def test_executable_data(tmpdir_cwd):
116116
dist.parse_command_line()
117117
dist.run_commands()
118118

119-
assert (
120-
os.stat('build/lib/pkg/run-me').st_mode & stat.S_IEXEC
121-
), "Script is not executable"
119+
assert os.stat('build/lib/pkg/run-me').st_mode & stat.S_IEXEC, (
120+
"Script is not executable"
121+
)
122122

123123

124124
EXAMPLE_WITH_MANIFEST = {

setuptools/tests/test_easy_install.py

+13-14
Original file line numberDiff line numberDiff line change
@@ -327,27 +327,27 @@ def test_many_pth_distributions_merge_together(self, tmpdir):
327327
pth_path = str(pth_subdir.join("file1.pth"))
328328
pth1 = PthDistributions(pth_path)
329329
pth2 = PthDistributions(pth_path)
330-
assert (
331-
pth1.paths == pth2.paths == []
332-
), "unless there would be some default added at some point"
330+
assert pth1.paths == pth2.paths == [], (
331+
"unless there would be some default added at some point"
332+
)
333333
# and so putting the src_subdir in folder distinct than the pth one,
334334
# so to keep it absolute by PthDistributions
335335
new_src_path = tmpdir.join("src_subdir")
336336
new_src_path.mkdir() # must exist to be accounted
337337
new_src_path_str = str(new_src_path)
338338
pth1.paths.append(new_src_path_str)
339339
pth1.save()
340-
assert (
341-
pth1.paths
342-
), "the new_src_path added must still be present/valid in pth1 after save"
340+
assert pth1.paths, (
341+
"the new_src_path added must still be present/valid in pth1 after save"
342+
)
343343
# now,
344-
assert (
345-
new_src_path_str not in pth2.paths
346-
), "right before we save the entry should still not be present"
344+
assert new_src_path_str not in pth2.paths, (
345+
"right before we save the entry should still not be present"
346+
)
347347
pth2.save()
348-
assert (
349-
new_src_path_str in pth2.paths
350-
), "the new_src_path entry should have been added by pth2 with its save() call"
348+
assert new_src_path_str in pth2.paths, (
349+
"the new_src_path entry should have been added by pth2 with its save() call"
350+
)
351351
assert pth2.paths[-1] == new_src_path, (
352352
"and it should match exactly on the last entry actually "
353353
"given we append to it in save()"
@@ -719,8 +719,7 @@ def test_setup_requires_override_nspkg(self, use_setup_cfg):
719719
run_setup(test_setup_py, ['--name'])
720720
except pkg_resources.VersionConflict:
721721
self.fail(
722-
'Installing setup.py requirements '
723-
'caused a VersionConflict'
722+
'Installing setup.py requirements caused a VersionConflict'
724723
)
725724

726725
assert 'FAIL' not in stdout.getvalue()

0 commit comments

Comments
 (0)