Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workaround for clash between ruff in pre-commit hook and pytest-ruff #4705

Merged
merged 2 commits into from
Oct 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.7
rev: v0.7.1
hooks:
- id: ruff
args: [--fix, --unsafe-fixes]
Expand Down
3 changes: 1 addition & 2 deletions setuptools/command/alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ def finalize_options(self):
option_base.finalize_options(self)
if self.remove and len(self.args) != 1:
raise DistutilsOptionError(
"Must specify exactly one argument (the alias name) when "
"using --remove"
"Must specify exactly one argument (the alias name) when using --remove"
)

def run(self):
Expand Down
6 changes: 3 additions & 3 deletions setuptools/command/bdist_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,9 +390,9 @@ def get_tag(self) -> tuple[str, str, str]:
supported_tags = [
(t.interpreter, t.abi, plat_name) for t in tags.sys_tags()
]
assert (
tag in supported_tags
), f"would build wheel with unsupported tag {tag}"
assert tag in supported_tags, (
f"would build wheel with unsupported tag {tag}"
)
return tag

def run(self):
Expand Down
3 changes: 1 addition & 2 deletions setuptools/command/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ def finalize_options(self):
elif self.single_version_externally_managed:
if not self.root and not self.record:
raise DistutilsArgError(
"You must specify --record or --root when building system"
" packages"
"You must specify --record or --root when building system packages"
)

def handle_extra_path(self):
Expand Down
4 changes: 1 addition & 3 deletions setuptools/tests/config/test_setupcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,7 @@ def test_not_utf8(self, tmpdir):
"""
fake_env(
tmpdir,
'# vim: set fileencoding=iso-8859-15 :\n'
'[metadata]\n'
'description = éàïôñ\n',
'# vim: set fileencoding=iso-8859-15 :\n[metadata]\ndescription = éàïôñ\n',
encoding='iso-8859-15',
)
with pytest.raises(UnicodeDecodeError):
Expand Down
12 changes: 6 additions & 6 deletions setuptools/tests/test_build_py.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ def test_recursive_in_package_data_glob(tmpdir_cwd):
dist.parse_command_line()
dist.run_commands()

assert stat.S_ISREG(
os.stat('build/lib/path/subpath/subsubpath/data').st_mode
), "File is not included"
assert stat.S_ISREG(os.stat('build/lib/path/subpath/subsubpath/data').st_mode), (
"File is not included"
)


def test_read_only(tmpdir_cwd):
Expand Down Expand Up @@ -116,9 +116,9 @@ def test_executable_data(tmpdir_cwd):
dist.parse_command_line()
dist.run_commands()

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


EXAMPLE_WITH_MANIFEST = {
Expand Down
27 changes: 13 additions & 14 deletions setuptools/tests/test_easy_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,27 +327,27 @@ def test_many_pth_distributions_merge_together(self, tmpdir):
pth_path = str(pth_subdir.join("file1.pth"))
pth1 = PthDistributions(pth_path)
pth2 = PthDistributions(pth_path)
assert (
pth1.paths == pth2.paths == []
), "unless there would be some default added at some point"
assert pth1.paths == pth2.paths == [], (
"unless there would be some default added at some point"
)
# and so putting the src_subdir in folder distinct than the pth one,
# so to keep it absolute by PthDistributions
new_src_path = tmpdir.join("src_subdir")
new_src_path.mkdir() # must exist to be accounted
new_src_path_str = str(new_src_path)
pth1.paths.append(new_src_path_str)
pth1.save()
assert (
pth1.paths
), "the new_src_path added must still be present/valid in pth1 after save"
assert pth1.paths, (
"the new_src_path added must still be present/valid in pth1 after save"
)
# now,
assert (
new_src_path_str not in pth2.paths
), "right before we save the entry should still not be present"
assert new_src_path_str not in pth2.paths, (
"right before we save the entry should still not be present"
)
pth2.save()
assert (
new_src_path_str in pth2.paths
), "the new_src_path entry should have been added by pth2 with its save() call"
assert new_src_path_str in pth2.paths, (
"the new_src_path entry should have been added by pth2 with its save() call"
)
assert pth2.paths[-1] == new_src_path, (
"and it should match exactly on the last entry actually "
"given we append to it in save()"
Expand Down Expand Up @@ -719,8 +719,7 @@ def test_setup_requires_override_nspkg(self, use_setup_cfg):
run_setup(test_setup_py, ['--name'])
except pkg_resources.VersionConflict:
self.fail(
'Installing setup.py requirements '
'caused a VersionConflict'
'Installing setup.py requirements caused a VersionConflict'
)

assert 'FAIL' not in stdout.getvalue()
Expand Down
Loading