Skip to content

Commit aae0226

Browse files
committed
test: enable ruff rule PT006 and PT007
It turns out that I just had to run uv run ruff check --fix --unsafe-fixes
1 parent bc1542c commit aae0226

29 files changed

+132
-134
lines changed

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,6 @@ ignore = [
239239
"E501",
240240
"D1",
241241
"D415",
242-
"PT006", # TODO(bearomorphism): enable this rule
243-
"PT007", # TODO(bearomorphism): enable this rule
244242
"PT011", # TODO(bearomorphism): enable this rule
245243
"PT022", # TODO(bearomorphism): enable this rule
246244
]

tests/commands/test_bump_command.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,14 @@
4040

4141
@pytest.mark.parametrize(
4242
"commit_msg",
43-
(
43+
[
4444
"fix: username exception",
4545
"fix(user): username exception",
4646
"refactor: remove ini configuration support",
4747
"refactor(config): remove ini configuration support",
4848
"perf: update to use multiprocess",
4949
"perf(worker): update to use multiprocess",
50-
),
50+
],
5151
)
5252
@pytest.mark.usefixtures("tmp_commitizen_project")
5353
def test_bump_patch_increment(commit_msg: str, util: UtilFixture):
@@ -56,7 +56,7 @@ def test_bump_patch_increment(commit_msg: str, util: UtilFixture):
5656
assert git.tag_exist("0.1.1") is True
5757

5858

59-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
59+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
6060
@pytest.mark.usefixtures("tmp_commitizen_project")
6161
def test_bump_minor_increment(commit_msg: str, util: UtilFixture):
6262
util.create_file_and_commit(commit_msg)
@@ -68,7 +68,7 @@ def test_bump_minor_increment(commit_msg: str, util: UtilFixture):
6868
)
6969

7070

71-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
71+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
7272
@pytest.mark.usefixtures("tmp_commitizen_project")
7373
def test_bump_minor_increment_annotated(commit_msg: str, util: UtilFixture):
7474
util.create_file_and_commit(commit_msg)
@@ -82,7 +82,7 @@ def test_bump_minor_increment_annotated(commit_msg: str, util: UtilFixture):
8282
assert git.is_signed_tag("0.2.0") is False
8383

8484

85-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
85+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
8686
@pytest.mark.usefixtures("tmp_commitizen_project_with_gpg")
8787
def test_bump_minor_increment_signed(commit_msg: str, util: UtilFixture):
8888
util.create_file_and_commit(commit_msg)
@@ -96,7 +96,7 @@ def test_bump_minor_increment_signed(commit_msg: str, util: UtilFixture):
9696
assert git.is_signed_tag("0.2.0") is True
9797

9898

99-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
99+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
100100
def test_bump_minor_increment_annotated_config_file(
101101
commit_msg: str, util: UtilFixture, pyproject: Path
102102
):
@@ -112,7 +112,7 @@ def test_bump_minor_increment_annotated_config_file(
112112
assert git.is_signed_tag("0.2.0") is False
113113

114114

115-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
115+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
116116
def test_bump_minor_increment_signed_config_file(
117117
commit_msg: str, util: UtilFixture, tmp_commitizen_project_with_gpg
118118
):
@@ -132,7 +132,7 @@ def test_bump_minor_increment_signed_config_file(
132132
@pytest.mark.usefixtures("tmp_commitizen_project")
133133
@pytest.mark.parametrize(
134134
"commit_msg",
135-
(
135+
[
136136
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported",
137137
"feat!: new user interface\n\nBREAKING CHANGE: age is no longer supported",
138138
"feat!: new user interface",
@@ -141,7 +141,7 @@ def test_bump_minor_increment_signed_config_file(
141141
"feat(user)!: new user interface",
142142
"BREAKING CHANGE: age is no longer supported",
143143
"BREAKING-CHANGE: age is no longer supported",
144-
),
144+
],
145145
)
146146
def test_bump_major_increment(commit_msg: str, util: UtilFixture):
147147
util.create_file_and_commit(commit_msg)
@@ -152,7 +152,7 @@ def test_bump_major_increment(commit_msg: str, util: UtilFixture):
152152
@pytest.mark.usefixtures("tmp_commitizen_project")
153153
@pytest.mark.parametrize(
154154
"commit_msg",
155-
(
155+
[
156156
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported",
157157
"feat!: new user interface\n\nBREAKING CHANGE: age is no longer supported",
158158
"feat!: new user interface",
@@ -161,7 +161,7 @@ def test_bump_major_increment(commit_msg: str, util: UtilFixture):
161161
"feat(user)!: new user interface",
162162
"BREAKING CHANGE: age is no longer supported",
163163
"BREAKING-CHANGE: age is no longer supported",
164-
),
164+
],
165165
)
166166
def test_bump_major_increment_major_version_zero(commit_msg: str, util: UtilFixture):
167167
util.create_file_and_commit(commit_msg)
@@ -171,7 +171,7 @@ def test_bump_major_increment_major_version_zero(commit_msg: str, util: UtilFixt
171171

172172
@pytest.mark.usefixtures("tmp_commitizen_project")
173173
@pytest.mark.parametrize(
174-
"commit_msg,increment,expected_tag",
174+
("commit_msg", "increment", "expected_tag"),
175175
[
176176
("feat: new file", "PATCH", "0.1.1"),
177177
("fix: username exception", "major", "1.0.0"),
@@ -607,7 +607,7 @@ def test_bump_with_git_to_stdout_arg(util: UtilFixture, capsys: pytest.CaptureFi
607607

608608

609609
@pytest.mark.parametrize(
610-
"version_filepath, version_regex, version_file_content",
610+
("version_filepath", "version_regex", "version_file_content"),
611611
[
612612
pytest.param(
613613
"pyproject.toml",
@@ -779,7 +779,7 @@ def test_bump_manual_version_disallows_major_version_zero(util: UtilFixture):
779779

780780

781781
@pytest.mark.parametrize(
782-
"initial_version, expected_version_after_bump",
782+
("initial_version", "expected_version_after_bump"),
783783
[
784784
("1", "1.1.0"),
785785
("1.2", "1.3.0"),
@@ -805,7 +805,7 @@ def test_bump_version_with_less_components_in_config(
805805
assert expected_version_after_bump in f.read()
806806

807807

808-
@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
808+
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
809809
def test_bump_with_pre_bump_hooks(
810810
commit_msg, mocker: MockFixture, tmp_commitizen_project, util: UtilFixture
811811
):
@@ -993,7 +993,7 @@ def test_bump_command_prerelease_scheme_check_old_tags(
993993
@pytest.mark.usefixtures("tmp_commitizen_project")
994994
@pytest.mark.usefixtures("use_cz_semver")
995995
@pytest.mark.parametrize(
996-
"message, expected_tag",
996+
("message", "expected_tag"),
997997
[
998998
("minor: add users", "0.2.0"),
999999
("patch: bug affecting users", "0.1.1"),
@@ -1009,7 +1009,7 @@ def test_bump_with_plugin(util: UtilFixture, message: str, expected_tag: str):
10091009
@pytest.mark.usefixtures("tmp_commitizen_project")
10101010
@pytest.mark.usefixtures("use_cz_semver")
10111011
@pytest.mark.parametrize(
1012-
"message, expected_tag",
1012+
("message", "expected_tag"),
10131013
[
10141014
("minor: add users", "0.2.0"),
10151015
("patch: bug affecting users", "0.1.1"),
@@ -1061,14 +1061,14 @@ def test_bump_command_version_scheme_priority_over_version_type(util: UtilFixtur
10611061

10621062

10631063
@pytest.mark.parametrize(
1064-
"arg, cfg, expected",
1065-
(
1064+
("arg", "cfg", "expected"),
1065+
[
10661066
pytest.param("", "", "default", id="default"),
10671067
pytest.param("", "changelog.cfg", "from config", id="from-config"),
10681068
pytest.param(
10691069
"--template=changelog.cmd", "changelog.cfg", "from cmd", id="from-command"
10701070
),
1071-
),
1071+
],
10721072
)
10731073
def test_bump_template_option_precedence(
10741074
tmp_commitizen_project: Path,

tests/commands/test_changelog_command.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -692,7 +692,7 @@ def test_changelog_incremental_with_release_candidate_version(
692692

693693

694694
@pytest.mark.parametrize(
695-
"from_pre,to_pre", itertools.product(["alpha", "beta", "rc"], repeat=2)
695+
("from_pre", "to_pre"), itertools.product(["alpha", "beta", "rc"], repeat=2)
696696
)
697697
@pytest.mark.usefixtures("tmp_commitizen_project")
698698
@pytest.mark.freeze_time("2021-06-11")
@@ -856,13 +856,13 @@ def test_changelog_from_rev_latest_version_from_arg(
856856

857857
@pytest.mark.usefixtures("tmp_commitizen_project")
858858
@pytest.mark.parametrize(
859-
"rev_range,tag",
860-
(
859+
("rev_range", "tag"),
860+
[
861861
pytest.param("0.8.0", "0.2.0", id="single-not-found"),
862862
pytest.param("0.1.0..0.3.0", "0.3.0", id="lower-bound-not-found"),
863863
pytest.param("0.1.0..0.3.0", "0.1.0", id="upper-bound-not-found"),
864864
pytest.param("0.3.0..0.4.0", "0.2.0", id="none-found"),
865-
),
865+
],
866866
)
867867
def test_changelog_from_rev_range_not_found(
868868
config_path: str, rev_range: str, tag: str, util: UtilFixture
@@ -1270,14 +1270,14 @@ def test_changelog_from_current_version_tag_with_nonversion_tag(
12701270

12711271

12721272
@pytest.mark.parametrize(
1273-
"arg,cfg,expected",
1274-
(
1273+
("arg", "cfg", "expected"),
1274+
[
12751275
pytest.param("", "", "default", id="default"),
12761276
pytest.param("", "changelog.cfg", "from config", id="from-config"),
12771277
pytest.param(
12781278
"--template=changelog.cmd", "changelog.cfg", "from cmd", id="from-command"
12791279
),
1280-
),
1280+
],
12811281
)
12821282
def test_changelog_template_option_precedence(
12831283
tmp_commitizen_project: Path,
@@ -1588,12 +1588,12 @@ def test_changelog_template_extra_quotes(
15881588

15891589

15901590
@pytest.mark.parametrize(
1591-
"extra, expected",
1592-
(
1591+
("extra", "expected"),
1592+
[
15931593
pytest.param("key=value=", "value=", id="2-equals"),
15941594
pytest.param("key==value", "=value", id="2-consecutive-equals"),
15951595
pytest.param("key==value==", "=value==", id="multiple-equals"),
1596-
),
1596+
],
15971597
)
15981598
def test_changelog_template_extra_weird_but_valid(
15991599
changelog_tpl: Path,
@@ -1609,7 +1609,7 @@ def test_changelog_template_extra_weird_but_valid(
16091609
assert changelog_file.read_text() == expected
16101610

16111611

1612-
@pytest.mark.parametrize("extra", ("no-equal", "", "=no-key"))
1612+
@pytest.mark.parametrize("extra", ["no-equal", "", "=no-key"])
16131613
def test_changelog_template_extra_bad_format(
16141614
changelog_tpl: Path,
16151615
extra: str,

tests/commands/test_check_command.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,15 @@ def test_check_conventional_commit_succeeds(
113113

114114
@pytest.mark.parametrize(
115115
"commit_msg",
116-
(
116+
[
117117
"feat!(lang): removed polish language",
118118
"no conventional commit",
119119
(
120120
"ci: check commit message on merge\n"
121121
"testing with more complex commit mes\n\n"
122122
"age with error"
123123
),
124-
),
124+
],
125125
)
126126
def test_check_no_conventional_commit(commit_msg, config, tmpdir):
127127
tempfile = tmpdir.join("temp_commit_file")
@@ -133,12 +133,12 @@ def test_check_no_conventional_commit(commit_msg, config, tmpdir):
133133

134134
@pytest.mark.parametrize(
135135
"commit_msg",
136-
(
136+
[
137137
"feat(lang)!: removed polish language",
138138
"feat(lang): added polish language",
139139
"feat: add polish language",
140140
"bump: 0.0.1 -> 1.0.0",
141-
),
141+
],
142142
)
143143
def test_check_conventional_commit(commit_msg, config, success_mock: MockType, tmpdir):
144144
tempfile = tmpdir.join("temp_commit_file")

tests/commands/test_version_command.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def test_version_for_showing_project_version(config, capsys):
2929
assert "v0.0.1" in captured.out
3030

3131

32-
@pytest.mark.parametrize("project", (True, False))
32+
@pytest.mark.parametrize("project", [True, False])
3333
def test_version_for_showing_commitizen_version(config, capsys, project: bool):
3434
commands.Version(
3535
config,
@@ -73,7 +73,7 @@ def test_version_for_showing_commitizen_system_info(config, capsys):
7373
assert f"Operating System: {platform.system()}" in captured.out
7474

7575

76-
@pytest.mark.parametrize("project", (True, False))
76+
@pytest.mark.parametrize("project", [True, False])
7777
@pytest.mark.usefixtures("tmp_git_project")
7878
def test_version_use_version_provider(
7979
mocker: MockerFixture,
@@ -104,7 +104,7 @@ def test_version_use_version_provider(
104104

105105

106106
@pytest.mark.parametrize(
107-
"version, expected_version",
107+
("version", "expected_version"),
108108
[
109109
("1.0.0", "1\n"),
110110
("2.1.3", "2\n"),
@@ -126,7 +126,7 @@ def test_version_just_major(config, capsys, version: str, expected_version: str)
126126

127127

128128
@pytest.mark.parametrize(
129-
"version, expected_version",
129+
("version", "expected_version"),
130130
[
131131
("1.0.0", "0\n"),
132132
("2.1.3", "1\n"),
@@ -147,7 +147,7 @@ def test_version_just_minor(config, capsys, version: str, expected_version: str)
147147
assert expected_version == captured.out
148148

149149

150-
@pytest.mark.parametrize("argument", ("major", "minor"))
150+
@pytest.mark.parametrize("argument", ["major", "minor"])
151151
def test_version_just_major_error_no_project(config, capsys, argument: str):
152152
commands.Version(
153153
config,
@@ -164,7 +164,7 @@ def test_version_just_major_error_no_project(config, capsys, argument: str):
164164

165165

166166
@pytest.mark.parametrize(
167-
"version, tag_format, expected_output",
167+
("version", "tag_format", "expected_output"),
168168
[
169169
("1.2.3", "v$version", "v1.2.3\n"),
170170
("1.2.3", "$version", "1.2.3\n"),

tests/providers/test_cargo_provider.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,11 @@
229229

230230

231231
@pytest.mark.parametrize(
232-
"content, expected",
233-
(
232+
("content", "expected"),
233+
[
234234
(CARGO_TOML, CARGO_TOML_EXPECTED),
235235
(CARGO_WORKSPACE_TOML, CARGO_WORKSPACE_TOML_EXPECTED),
236-
),
236+
],
237237
)
238238
def test_cargo_provider(
239239
config: BaseConfig,
@@ -255,8 +255,8 @@ def test_cargo_provider(
255255

256256

257257
@pytest.mark.parametrize(
258-
"toml_content, lock_content, toml_expected, lock_expected",
259-
(
258+
("toml_content", "lock_content", "toml_expected", "lock_expected"),
259+
[
260260
(
261261
CARGO_TOML,
262262
CARGO_LOCK,
@@ -269,7 +269,7 @@ def test_cargo_provider(
269269
CARGO_WORKSPACE_TOML_EXPECTED,
270270
CARGO_WORKSPACE_LOCK_EXPECTED,
271271
),
272-
),
272+
],
273273
)
274274
def test_cargo_provider_with_lock(
275275
config: BaseConfig,

tests/providers/test_composer_provider.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@
2929

3030

3131
@pytest.mark.parametrize(
32-
"content, expected",
33-
((COMPOSER_JSON, COMPOSER_EXPECTED),),
32+
("content", "expected"),
33+
[(COMPOSER_JSON, COMPOSER_EXPECTED)],
3434
)
3535
def test_composer_provider(
3636
config: BaseConfig,

tests/providers/test_npm_provider.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@
6565

6666

6767
@pytest.mark.parametrize(
68-
"pkg_shrinkwrap_content, pkg_shrinkwrap_expected",
69-
((NPM_LOCKFILE_JSON, NPM_LOCKFILE_EXPECTED), (None, None)),
68+
("pkg_shrinkwrap_content", "pkg_shrinkwrap_expected"),
69+
[(NPM_LOCKFILE_JSON, NPM_LOCKFILE_EXPECTED), (None, None)],
7070
)
7171
@pytest.mark.parametrize(
72-
"pkg_lock_content, pkg_lock_expected",
73-
((NPM_LOCKFILE_JSON, NPM_LOCKFILE_EXPECTED), (None, None)),
72+
("pkg_lock_content", "pkg_lock_expected"),
73+
[(NPM_LOCKFILE_JSON, NPM_LOCKFILE_EXPECTED), (None, None)],
7474
)
7575
def test_npm_provider(
7676
config: BaseConfig,

0 commit comments

Comments
 (0)