Skip to content

Commit ac0e4f8

Browse files
authored
Set Ruff's pytest's parametrize-names-type to default (tuple) (#4730)
2 parents b27393a + 879ad20 commit ac0e4f8

18 files changed

+42
-44
lines changed

pkg_resources/tests/test_pkg_resources.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ def make_distribution_no_version(tmpdir, basename):
236236

237237

238238
@pytest.mark.parametrize(
239-
'suffix, expected_filename, expected_dist_type',
239+
("suffix", "expected_filename", "expected_dist_type"),
240240
[
241241
('egg-info', 'PKG-INFO', EggInfoDistribution),
242242
('dist-info', 'METADATA', DistInfoDistribution),
@@ -376,7 +376,7 @@ def test_version_resolved_from_egg_info(self, env):
376376
assert dist.version == version
377377

378378
@pytest.mark.parametrize(
379-
'unnormalized, normalized',
379+
("unnormalized", "normalized"),
380380
[
381381
('foo', 'foo'),
382382
('foo/', 'foo'),
@@ -398,7 +398,7 @@ def test_normalize_path_trailing_sep(self, unnormalized, normalized):
398398
reason='Testing case-insensitive filesystems.',
399399
)
400400
@pytest.mark.parametrize(
401-
'unnormalized, normalized',
401+
("unnormalized", "normalized"),
402402
[
403403
('MiXeD/CasE', 'mixed/case'),
404404
],
@@ -414,7 +414,7 @@ def test_normalize_path_normcase(self, unnormalized, normalized):
414414
reason='Testing systems using backslashes as path separators.',
415415
)
416416
@pytest.mark.parametrize(
417-
'unnormalized, expected',
417+
("unnormalized", "expected"),
418418
[
419419
('forward/slash', 'forward\\slash'),
420420
('forward/slash/', 'forward\\slash'),

pkg_resources/tests/test_resources.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ def test_spaces_between_multiple_versions(self):
700700
(req,) = parse_requirements('foo >= 1.0, < 3')
701701

702702
@pytest.mark.parametrize(
703-
'lower, upper',
703+
("lower", "upper"),
704704
[
705705
('1.2-rc1', '1.2rc1'),
706706
('0.4', '0.4.0'),
@@ -724,7 +724,7 @@ def testVersionEquality(self, lower, upper):
724724
"""
725725

726726
@pytest.mark.parametrize(
727-
'lower, upper',
727+
("lower", "upper"),
728728
[
729729
('2.1', '2.1.1'),
730730
('2a1', '2b0'),

ruff.toml

-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,6 @@ sections.delayed = ["distutils"]
8181
[lint.flake8-annotations]
8282
ignore-fully-untyped = true
8383

84-
[lint.flake8-pytest-style]
85-
parametrize-names-type = "csv"
86-
8784
[format]
8885
# Enable preview to get hugged parenthesis unwrapping and other nice surprises
8986
# See https://github.com/jaraco/skeleton/pull/133#issuecomment-2239538373

setuptools/tests/config/test_apply_pyprojecttoml.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def test_pep621_example(tmp_path):
183183

184184

185185
@pytest.mark.parametrize(
186-
"readme, ctype",
186+
("readme", "ctype"),
187187
[
188188
("Readme.txt", "text/plain"),
189189
("readme.md", "text/markdown"),
@@ -209,7 +209,7 @@ def test_no_explicit_content_type_for_missing_extension(tmp_path):
209209

210210

211211
@pytest.mark.parametrize(
212-
'pyproject_text, expected_maintainers_meta_value',
212+
("pyproject_text", "expected_maintainers_meta_value"),
213213
(
214214
pytest.param(
215215
PEP621_EXAMPLE,
@@ -370,7 +370,7 @@ def pyproject(self, tmp_path, dynamic, extra_content=""):
370370
return file
371371

372372
@pytest.mark.parametrize(
373-
"attr, field, value",
373+
("attr", "field", "value"),
374374
[
375375
("classifiers", "classifiers", ["Private :: Classifier"]),
376376
("entry_points", "scripts", {"console_scripts": ["foobar=foobar:main"]}),
@@ -395,7 +395,7 @@ def test_not_listed_in_dynamic(self, tmp_path, attr, field, value):
395395
assert not dist_value
396396

397397
@pytest.mark.parametrize(
398-
"attr, field, value",
398+
("attr", "field", "value"),
399399
[
400400
("install_requires", "dependencies", []),
401401
("extras_require", "optional-dependencies", {}),
@@ -442,7 +442,8 @@ def test_optional_dependencies_dont_remove_env_markers(self, tmp_path):
442442
assert ':python_version < "3.7"' in reqs
443443

444444
@pytest.mark.parametrize(
445-
"field,group", [("scripts", "console_scripts"), ("gui-scripts", "gui_scripts")]
445+
("field", "group"),
446+
[("scripts", "console_scripts"), ("gui-scripts", "gui_scripts")],
446447
)
447448
@pytest.mark.filterwarnings("error")
448449
def test_scripts_dont_require_dynamic_entry_points(self, tmp_path, field, group):

setuptools/tests/config/test_expand.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def test_import_order(self, tmp_path):
141141

142142

143143
@pytest.mark.parametrize(
144-
'package_dir, file, module, return_value',
144+
("package_dir", "file", "module", "return_value"),
145145
[
146146
({"": "src"}, "src/pkg/main.py", "pkg.main", 42),
147147
({"pkg": "lib"}, "lib/main.py", "pkg.main", 13),
@@ -158,7 +158,7 @@ def test_resolve_class(monkeypatch, tmp_path, package_dir, file, module, return_
158158

159159

160160
@pytest.mark.parametrize(
161-
'args, pkgs',
161+
("args", "pkgs"),
162162
[
163163
({"where": ["."], "namespaces": False}, {"pkg", "other"}),
164164
({"where": [".", "dir1"], "namespaces": False}, {"pkg", "other", "dir2"}),
@@ -192,7 +192,7 @@ def test_find_packages(tmp_path, args, pkgs):
192192

193193

194194
@pytest.mark.parametrize(
195-
"files, where, expected_package_dir",
195+
("files", "where", "expected_package_dir"),
196196
[
197197
(["pkg1/__init__.py", "pkg1/other.py"], ["."], {}),
198198
(["pkg1/__init__.py", "pkg2/__init__.py"], ["."], {}),

setuptools/tests/config/test_pyprojecttoml.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ def test_read_configuration(tmp_path):
149149

150150

151151
@pytest.mark.parametrize(
152-
"pkg_root, opts",
152+
("pkg_root", "opts"),
153153
[
154154
(".", {}),
155155
("src", {}),
@@ -308,7 +308,7 @@ def test_ignore_unrelated_config(tmp_path, example):
308308

309309

310310
@pytest.mark.parametrize(
311-
"example, error_msg",
311+
("example", "error_msg"),
312312
[
313313
(
314314
"""

setuptools/tests/integration/test_pip_install_sdist.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def _prepare(tmp_path, venv_python, monkeypatch):
122122
run([venv_python, "-m", "pip", "freeze"])
123123

124124

125-
@pytest.mark.parametrize('package, version', EXAMPLES)
125+
@pytest.mark.parametrize(("package", "version"), EXAMPLES)
126126
@pytest.mark.uses_network
127127
def test_install_sdist(package, version, tmp_path, venv_python, setuptools_wheel):
128128
venv_pip = (venv_python, "-m", "pip")

setuptools/tests/test_bdist_wheel.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def test_licenses_deprecated(dummy_dist, monkeypatch, tmp_path):
322322

323323

324324
@pytest.mark.parametrize(
325-
"config_file, config",
325+
("config_file", "config"),
326326
[
327327
("setup.cfg", "[metadata]\nlicense_files=licenses/*\n LICENSE"),
328328
("setup.cfg", "[metadata]\nlicense_files=licenses/*, LICENSE"),
@@ -434,7 +434,7 @@ def test_build_from_readonly_tree(dummy_dist, monkeypatch, tmp_path):
434434

435435

436436
@pytest.mark.parametrize(
437-
"option, compress_type",
437+
("option", "compress_type"),
438438
list(bdist_wheel.supported_compressions.items()),
439439
ids=list(bdist_wheel.supported_compressions),
440440
)
@@ -589,7 +589,7 @@ def test_data_dir_with_tag_build(monkeypatch, tmp_path):
589589

590590

591591
@pytest.mark.parametrize(
592-
"reported,expected",
592+
("reported", "expected"),
593593
[("linux-x86_64", "linux_i686"), ("linux-aarch64", "linux_armv7l")],
594594
)
595595
@pytest.mark.skipif(

setuptools/tests/test_build_meta.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,7 @@ def test_editable_with_config_settings(self, tmpdir_cwd, config_settings):
737737
self._assert_link_tree(next(Path("build").glob("__editable__.*")))
738738

739739
@pytest.mark.parametrize(
740-
'setup_literal, requirements',
740+
("setup_literal", "requirements"),
741741
[
742742
("'foo'", ['foo']),
743743
("['foo']", ['foo']),

setuptools/tests/test_config_discovery.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ def test_project(self, tmp_path, circumstance):
161161
}
162162

163163
@pytest.mark.parametrize(
164-
"config_file, param, circumstance",
164+
("config_file", "param", "circumstance"),
165165
product(
166166
["setup.cfg", "setup.py", "pyproject.toml"],
167167
["packages", "py_modules"],
@@ -191,7 +191,7 @@ def test_purposefully_empty(self, tmp_path, config_file, param, circumstance):
191191
assert getattr(dist, other) is None
192192

193193
@pytest.mark.parametrize(
194-
"extra_files, pkgs",
194+
("extra_files", "pkgs"),
195195
[
196196
(["venv/bin/simulate_venv"], {"pkg"}),
197197
(["pkg-stubs/__init__.pyi"], {"pkg", "pkg-stubs"}),
@@ -284,7 +284,7 @@ def test_build_with_discovered_name(self, tmp_path):
284284

285285
class TestWithAttrDirective:
286286
@pytest.mark.parametrize(
287-
"folder, opts",
287+
("folder", "opts"),
288288
[
289289
("src", {}),
290290
("lib", {"packages": "find:", "packages.find": {"where": "lib"}}),
@@ -446,7 +446,7 @@ def _simulate_package_with_data_files(self, tmp_path, src_root):
446446
"""
447447

448448
@pytest.mark.parametrize(
449-
"src_root, files",
449+
("src_root", "files"),
450450
[
451451
(".", {"setup.cfg": DALS(EXAMPLE_SETUPCFG)}),
452452
(".", {"pyproject.toml": DALS(EXAMPLE_PYPROJECT)}),

setuptools/tests/test_core_metadata.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424

2525
@pytest.mark.parametrize(
26-
'content, result',
26+
("content", "result"),
2727
(
2828
pytest.param(
2929
"Just a single line",
@@ -154,7 +154,7 @@ def __read_test_cases():
154154
]
155155

156156

157-
@pytest.mark.parametrize('name,attrs', __read_test_cases())
157+
@pytest.mark.parametrize(("name", "attrs"), __read_test_cases())
158158
def test_read_metadata(name, attrs):
159159
dist = Distribution(attrs)
160160
metadata_out = dist.metadata
@@ -263,7 +263,7 @@ def merge_dicts(d1, d2):
263263
]
264264

265265

266-
@pytest.mark.parametrize('name,attrs', __maintainer_test_cases())
266+
@pytest.mark.parametrize(("name", "attrs"), __maintainer_test_cases())
267267
def test_maintainer_author(name, attrs, tmpdir):
268268
tested_keys = {
269269
'author': 'Author',

setuptools/tests/test_dist.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ def test_provides_extras_deterministic_order():
129129
)
130130

131131

132-
@pytest.mark.parametrize('package_data, expected_message', CHECK_PACKAGE_DATA_TESTS)
132+
@pytest.mark.parametrize(('package_data', 'expected_message'), CHECK_PACKAGE_DATA_TESTS)
133133
def test_check_package_data(package_data, expected_message):
134134
if expected_message is None:
135135
assert check_package_data(None, 'package_data', package_data) is None
@@ -156,7 +156,7 @@ def test_metadata_name():
156156

157157

158158
@pytest.mark.parametrize(
159-
"dist_name, py_module",
159+
('dist_name', 'py_module'),
160160
[
161161
("my.pkg", "my_pkg"),
162162
("my-pkg", "my_pkg"),
@@ -187,7 +187,7 @@ def test_dist_default_py_modules(tmp_path, dist_name, py_module):
187187

188188

189189
@pytest.mark.parametrize(
190-
"dist_name, package_dir, package_files, packages",
190+
('dist_name', 'package_dir', 'package_files', 'packages'),
191191
[
192192
("my.pkg", None, ["my_pkg/__init__.py", "my_pkg/mod.py"], ["my_pkg"]),
193193
("my-pkg", None, ["my_pkg/__init__.py", "my_pkg/mod.py"], ["my_pkg"]),
@@ -241,7 +241,7 @@ def test_dist_default_packages(
241241

242242

243243
@pytest.mark.parametrize(
244-
"dist_name, package_dir, package_files",
244+
('dist_name', 'package_dir', 'package_files'),
245245
[
246246
("my.pkg.nested", None, ["my/pkg/nested/__init__.py"]),
247247
("my.pkg", None, ["my/pkg/__init__.py", "my/pkg/file.py"]),

setuptools/tests/test_dist_info.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ class TestWheelCompatibility:
169169

170170
@pytest.mark.parametrize("name", "my-proj my_proj my.proj My.Proj".split())
171171
@pytest.mark.parametrize("version", ["0.42.13"])
172-
@pytest.mark.parametrize("suffix, cfg", EGG_INFO_OPTS)
172+
@pytest.mark.parametrize(("suffix", "cfg"), EGG_INFO_OPTS)
173173
def test_dist_info_is_the_same_as_in_wheel(
174174
self, name, version, tmp_path, suffix, cfg
175175
):

setuptools/tests/test_distutils_adoption.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def test_distutils_has_origin():
116116

117117
@pytest.mark.usefixtures("tmpdir_cwd")
118118
@pytest.mark.parametrize(
119-
"distutils_version, imported_module",
119+
('distutils_version', 'imported_module'),
120120
[
121121
pytest.param("stdlib", "dir_util", marks=skip_without_stdlib_distutils),
122122
pytest.param("stdlib", "file_util", marks=skip_without_stdlib_distutils),
@@ -175,7 +175,7 @@ def test_log_module_is_not_duplicated_on_import(distutils_version, venv):
175175

176176
@pytest.mark.usefixtures("tmpdir_cwd")
177177
@pytest.mark.parametrize(
178-
"distutils_version, imported_module",
178+
('distutils_version', 'imported_module'),
179179
[
180180
("local", "distutils"),
181181
# Unfortunately we still get ._distutils.errors.DistutilsError with SETUPTOOLS_USE_DISTUTILS=stdlib

setuptools/tests/test_egg_info.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -543,7 +543,7 @@ def test_doesnt_provides_extra(self, tmpdir_cwd, env):
543543
assert 'Provides-Extra:' not in pkg_info_text
544544

545545
@pytest.mark.parametrize(
546-
"files, license_in_sources",
546+
('files', 'license_in_sources'),
547547
[
548548
(
549549
{
@@ -627,7 +627,7 @@ def test_setup_cfg_license_file(self, tmpdir_cwd, env, files, license_in_sources
627627
assert 'INVALID_LICENSE' not in sources_text
628628

629629
@pytest.mark.parametrize(
630-
"files, incl_licenses, excl_licenses",
630+
('files', 'incl_licenses', 'excl_licenses'),
631631
[
632632
(
633633
{
@@ -839,7 +839,7 @@ def test_setup_cfg_license_files(
839839
assert sources_lines.count(lf) == 0
840840

841841
@pytest.mark.parametrize(
842-
"files, incl_licenses, excl_licenses",
842+
('files', 'incl_licenses', 'excl_licenses'),
843843
[
844844
(
845845
{

setuptools/tests/test_glob.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66

77
@pytest.mark.parametrize(
8-
'tree, pattern, matches',
8+
('tree', 'pattern', 'matches'),
99
(
1010
('', b'', []),
1111
('', '', []),

setuptools/tests/test_logging.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
@pytest.mark.parametrize(
22-
"flag, expected_level", [("--dry-run", "INFO"), ("--verbose", "DEBUG")]
22+
('flag', 'expected_level'), [("--dry-run", "INFO"), ("--verbose", "DEBUG")]
2323
)
2424
def test_verbosity_level(tmp_path, monkeypatch, flag, expected_level):
2525
"""Make sure the correct verbosity level is set (issue #3038)"""

setuptools/tests/test_wheel.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878

7979

8080
@pytest.mark.parametrize(
81-
'filename, info', WHEEL_INFO_TESTS, ids=[t[0] for t in WHEEL_INFO_TESTS]
81+
('filename', 'info'), WHEEL_INFO_TESTS, ids=[t[0] for t in WHEEL_INFO_TESTS]
8282
)
8383
def test_wheel_info(filename, info):
8484
if inspect.isclass(info):

0 commit comments

Comments
 (0)