Skip to content
Open
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
10 changes: 1 addition & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -235,15 +235,7 @@ select = [
"TC005",
"TC006",
]
ignore = [
"E501",
"D1",
"D415",
"PT006", # TODO(bearomorphism): enable this rule
"PT007", # TODO(bearomorphism): enable this rule
"PT011", # TODO(bearomorphism): enable this rule
"PT022", # TODO(bearomorphism): enable this rule
]
ignore = ["E501", "D1", "D415"]
extend-safe-fixes = [
"TC", # Move imports inside/outside TYPE_CHECKING blocks
"UP", # Update syntaxes for current Python version recommendations
Expand Down
40 changes: 20 additions & 20 deletions tests/commands/test_bump_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,14 @@

@pytest.mark.parametrize(
"commit_msg",
(
[
"fix: username exception",
"fix(user): username exception",
"refactor: remove ini configuration support",
"refactor(config): remove ini configuration support",
"perf: update to use multiprocess",
"perf(worker): update to use multiprocess",
),
],
)
@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_patch_increment(commit_msg: str, util: UtilFixture):
Expand All @@ -56,7 +56,7 @@ def test_bump_patch_increment(commit_msg: str, util: UtilFixture):
assert git.tag_exist("0.1.1") is True


@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
@pytest.mark.usefixtures("tmp_commitizen_project")
def test_bump_minor_increment(commit_msg: str, util: UtilFixture):
util.create_file_and_commit(commit_msg)
Expand All @@ -68,7 +68,7 @@ def test_bump_minor_increment(commit_msg: str, util: UtilFixture):
)


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


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


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


@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
def test_bump_minor_increment_signed_config_file(
commit_msg: str, util: UtilFixture, tmp_commitizen_project_with_gpg
):
Expand All @@ -132,7 +132,7 @@ def test_bump_minor_increment_signed_config_file(
@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.parametrize(
"commit_msg",
(
[
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported",
"feat!: new user interface\n\nBREAKING CHANGE: age is no longer supported",
"feat!: new user interface",
Expand All @@ -141,7 +141,7 @@ def test_bump_minor_increment_signed_config_file(
"feat(user)!: new user interface",
"BREAKING CHANGE: age is no longer supported",
"BREAKING-CHANGE: age is no longer supported",
),
],
)
def test_bump_major_increment(commit_msg: str, util: UtilFixture):
util.create_file_and_commit(commit_msg)
Expand All @@ -152,7 +152,7 @@ def test_bump_major_increment(commit_msg: str, util: UtilFixture):
@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.parametrize(
"commit_msg",
(
[
"feat: new user interface\n\nBREAKING CHANGE: age is no longer supported",
"feat!: new user interface\n\nBREAKING CHANGE: age is no longer supported",
"feat!: new user interface",
Expand All @@ -161,7 +161,7 @@ def test_bump_major_increment(commit_msg: str, util: UtilFixture):
"feat(user)!: new user interface",
"BREAKING CHANGE: age is no longer supported",
"BREAKING-CHANGE: age is no longer supported",
),
],
)
def test_bump_major_increment_major_version_zero(commit_msg: str, util: UtilFixture):
util.create_file_and_commit(commit_msg)
Expand All @@ -171,7 +171,7 @@ def test_bump_major_increment_major_version_zero(commit_msg: str, util: UtilFixt

@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.parametrize(
"commit_msg,increment,expected_tag",
("commit_msg", "increment", "expected_tag"),
[
("feat: new file", "PATCH", "0.1.1"),
("fix: username exception", "major", "1.0.0"),
Expand Down Expand Up @@ -607,7 +607,7 @@ def test_bump_with_git_to_stdout_arg(util: UtilFixture, capsys: pytest.CaptureFi


@pytest.mark.parametrize(
"version_filepath, version_regex, version_file_content",
("version_filepath", "version_regex", "version_file_content"),
[
pytest.param(
"pyproject.toml",
Expand Down Expand Up @@ -779,7 +779,7 @@ def test_bump_manual_version_disallows_major_version_zero(util: UtilFixture):


@pytest.mark.parametrize(
"initial_version, expected_version_after_bump",
("initial_version", "expected_version_after_bump"),
[
("1", "1.1.0"),
("1.2", "1.3.0"),
Expand All @@ -805,7 +805,7 @@ def test_bump_version_with_less_components_in_config(
assert expected_version_after_bump in f.read()


@pytest.mark.parametrize("commit_msg", ("feat: new file", "feat(user): new file"))
@pytest.mark.parametrize("commit_msg", ["feat: new file", "feat(user): new file"])
def test_bump_with_pre_bump_hooks(
commit_msg, mocker: MockFixture, tmp_commitizen_project, util: UtilFixture
):
Expand Down Expand Up @@ -993,7 +993,7 @@ def test_bump_command_prerelease_scheme_check_old_tags(
@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.usefixtures("use_cz_semver")
@pytest.mark.parametrize(
"message, expected_tag",
("message", "expected_tag"),
[
("minor: add users", "0.2.0"),
("patch: bug affecting users", "0.1.1"),
Expand All @@ -1009,7 +1009,7 @@ def test_bump_with_plugin(util: UtilFixture, message: str, expected_tag: str):
@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.usefixtures("use_cz_semver")
@pytest.mark.parametrize(
"message, expected_tag",
("message", "expected_tag"),
[
("minor: add users", "0.2.0"),
("patch: bug affecting users", "0.1.1"),
Expand Down Expand Up @@ -1061,14 +1061,14 @@ def test_bump_command_version_scheme_priority_over_version_type(util: UtilFixtur


@pytest.mark.parametrize(
"arg, cfg, expected",
(
("arg", "cfg", "expected"),
[
pytest.param("", "", "default", id="default"),
pytest.param("", "changelog.cfg", "from config", id="from-config"),
pytest.param(
"--template=changelog.cmd", "changelog.cfg", "from cmd", id="from-command"
),
),
],
)
def test_bump_template_option_precedence(
tmp_commitizen_project: Path,
Expand Down
22 changes: 11 additions & 11 deletions tests/commands/test_changelog_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ def test_changelog_incremental_with_release_candidate_version(


@pytest.mark.parametrize(
"from_pre,to_pre", itertools.product(["alpha", "beta", "rc"], repeat=2)
("from_pre", "to_pre"), itertools.product(["alpha", "beta", "rc"], repeat=2)
)
@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.freeze_time("2021-06-11")
Expand Down Expand Up @@ -856,13 +856,13 @@ def test_changelog_from_rev_latest_version_from_arg(

@pytest.mark.usefixtures("tmp_commitizen_project")
@pytest.mark.parametrize(
"rev_range,tag",
(
("rev_range", "tag"),
[
pytest.param("0.8.0", "0.2.0", id="single-not-found"),
pytest.param("0.1.0..0.3.0", "0.3.0", id="lower-bound-not-found"),
pytest.param("0.1.0..0.3.0", "0.1.0", id="upper-bound-not-found"),
pytest.param("0.3.0..0.4.0", "0.2.0", id="none-found"),
),
],
)
def test_changelog_from_rev_range_not_found(
config_path: str, rev_range: str, tag: str, util: UtilFixture
Expand Down Expand Up @@ -1270,14 +1270,14 @@ def test_changelog_from_current_version_tag_with_nonversion_tag(


@pytest.mark.parametrize(
"arg,cfg,expected",
(
("arg", "cfg", "expected"),
[
pytest.param("", "", "default", id="default"),
pytest.param("", "changelog.cfg", "from config", id="from-config"),
pytest.param(
"--template=changelog.cmd", "changelog.cfg", "from cmd", id="from-command"
),
),
],
)
def test_changelog_template_option_precedence(
tmp_commitizen_project: Path,
Expand Down Expand Up @@ -1588,12 +1588,12 @@ def test_changelog_template_extra_quotes(


@pytest.mark.parametrize(
"extra, expected",
(
("extra", "expected"),
[
pytest.param("key=value=", "value=", id="2-equals"),
pytest.param("key==value", "=value", id="2-consecutive-equals"),
pytest.param("key==value==", "=value==", id="multiple-equals"),
),
],
)
def test_changelog_template_extra_weird_but_valid(
changelog_tpl: Path,
Expand All @@ -1609,7 +1609,7 @@ def test_changelog_template_extra_weird_but_valid(
assert changelog_file.read_text() == expected


@pytest.mark.parametrize("extra", ("no-equal", "", "=no-key"))
@pytest.mark.parametrize("extra", ["no-equal", "", "=no-key"])
def test_changelog_template_extra_bad_format(
changelog_tpl: Path,
extra: str,
Expand Down
8 changes: 4 additions & 4 deletions tests/commands/test_check_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ def test_check_conventional_commit_succeeds(

@pytest.mark.parametrize(
"commit_msg",
(
[
"feat!(lang): removed polish language",
"no conventional commit",
(
"ci: check commit message on merge\n"
"testing with more complex commit mes\n\n"
"age with error"
),
),
],
)
def test_check_no_conventional_commit(commit_msg, config, tmpdir):
tempfile = tmpdir.join("temp_commit_file")
Expand All @@ -133,12 +133,12 @@ def test_check_no_conventional_commit(commit_msg, config, tmpdir):

@pytest.mark.parametrize(
"commit_msg",
(
[
"feat(lang)!: removed polish language",
"feat(lang): added polish language",
"feat: add polish language",
"bump: 0.0.1 -> 1.0.0",
),
],
)
def test_check_conventional_commit(commit_msg, config, success_mock: MockType, tmpdir):
tempfile = tmpdir.join("temp_commit_file")
Expand Down
4 changes: 2 additions & 2 deletions tests/commands/test_commit_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ def test_commit_when_customized_expected_raised(config, mocker: MockFixture):

@pytest.mark.usefixtures("staging_is_clean")
def test_commit_when_non_customized_expected_raised(config, mocker: MockFixture):
mocker.patch("questionary.prompt", side_effect=ValueError())
with pytest.raises(ValueError):
mocker.patch("questionary.prompt", side_effect=ValueError("error message"))
with pytest.raises(ValueError, match="error message"):
commands.Commit(config, {})()


Expand Down
12 changes: 6 additions & 6 deletions tests/commands/test_version_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def test_version_for_showing_project_version(config, capsys):
assert "v0.0.1" in captured.out


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


@pytest.mark.parametrize("project", (True, False))
@pytest.mark.parametrize("project", [True, False])
@pytest.mark.usefixtures("tmp_git_project")
def test_version_use_version_provider(
mocker: MockerFixture,
Expand Down Expand Up @@ -104,7 +104,7 @@ def test_version_use_version_provider(


@pytest.mark.parametrize(
"version, expected_version",
("version", "expected_version"),
[
("1.0.0", "1\n"),
("2.1.3", "2\n"),
Expand All @@ -126,7 +126,7 @@ def test_version_just_major(config, capsys, version: str, expected_version: str)


@pytest.mark.parametrize(
"version, expected_version",
("version", "expected_version"),
[
("1.0.0", "0\n"),
("2.1.3", "1\n"),
Expand All @@ -147,7 +147,7 @@ def test_version_just_minor(config, capsys, version: str, expected_version: str)
assert expected_version == captured.out


@pytest.mark.parametrize("argument", ("major", "minor"))
@pytest.mark.parametrize("argument", ["major", "minor"])
def test_version_just_major_error_no_project(config, capsys, argument: str):
commands.Version(
config,
Expand All @@ -164,7 +164,7 @@ def test_version_just_major_error_no_project(config, capsys, argument: str):


@pytest.mark.parametrize(
"version, tag_format, expected_output",
("version", "tag_format", "expected_output"),
[
("1.2.3", "v$version", "v1.2.3\n"),
("1.2.3", "$version", "1.2.3\n"),
Expand Down
Loading