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: 5 additions & 5 deletions tests/commands/test_commit_command.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os
from pathlib import Path
from unittest.mock import ANY

import pytest
Expand Down Expand Up @@ -76,7 +76,7 @@ def test_commit_backup_on_failure(

prompt_mock_feat.assert_called_once()
error_mock.assert_called_once()
assert os.path.isfile(temp_file)
assert Path(temp_file).exists()


@pytest.mark.usefixtures("staging_is_clean", "commit_mock")
Expand All @@ -100,7 +100,7 @@ def test_commit_retry_works(
commit_mock.assert_called_with("backup commit", args="")
prompt_mock.assert_not_called()
success_mock.assert_called_once()
assert not os.path.isfile(temp_file)
assert not Path(temp_file).exists()


@pytest.mark.usefixtures("staging_is_clean")
Expand Down Expand Up @@ -129,7 +129,7 @@ def test_commit_retry_after_failure_works(
commit_mock.assert_called_with("backup commit", args="")
prompt_mock.assert_not_called()
success_mock.assert_called_once()
assert not os.path.isfile(temp_file)
assert not Path(temp_file).exists()


@pytest.mark.usefixtures("staging_is_clean", "backup_file")
Expand All @@ -144,7 +144,7 @@ def test_commit_retry_after_failure_with_no_retry_works(
commit_mock.assert_called_with("feat: user created\n\ncloses #21", args="")
prompt_mock_feat.assert_called_once()
success_mock.assert_called_once()
assert not os.path.isfile(temp_file)
assert not Path(temp_file).exists()


@pytest.mark.usefixtures("staging_is_clean", "prompt_mock_feat")
Expand Down
5 changes: 2 additions & 3 deletions tests/commands/test_init_command.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from __future__ import annotations

import json
import os
from pathlib import Path
from typing import TYPE_CHECKING, Any

Expand Down Expand Up @@ -85,12 +84,12 @@ def test_init_without_setup_pre_commit_hook(
config_data = toml_file.read()
assert config_data == expected_config

assert not os.path.isfile(pre_commit_config_filename)
assert not Path(pre_commit_config_filename).exists()


def test_init_when_config_already_exists(config: BaseConfig, capsys):
# Set config path
path = Path(os.sep.join(["tests", "pyproject.toml"]))
path = Path("tests") / "pyproject.toml"
config.path = path

commands.Init(config)()
Expand Down
14 changes: 6 additions & 8 deletions tests/test_changelog.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from __future__ import annotations

import os
import re
from dataclasses import dataclass
from pathlib import Path
Expand Down Expand Up @@ -1672,17 +1671,16 @@ def test_changelog_file_name_from_args_and_config():

args = {
"file_name": "CUSTOM.md",
"incremental": None,
"dry_run": False,
"unreleased_version": "1.0.1",
}
changelog = Changelog(mock_config, args)
assert os.path.normpath(changelog.file_name) == os.path.normpath(
os.path.join("/my/project", "CUSTOM.md")
assert (
Path(changelog.file_name).resolve() == Path("/my/project/CUSTOM.md").resolve()
)

args = {"incremental": None, "dry_run": False, "unreleased_version": "1.0.1"}
args = {"unreleased_version": "1.0.1"}
changelog = Changelog(mock_config, args)
assert os.path.normpath(changelog.file_name) == os.path.normpath(
os.path.join("/my/project", "CHANGELOG.md")
assert (
Path(changelog.file_name).resolve()
== Path("/my/project/CHANGELOG.md").resolve()
)