Skip to content

Commit

Permalink
test: Clean up path fixtures
Browse files Browse the repository at this point in the history
config_path and changelog_path rely on the modified CWD provided by
tmp_commitizen_project, so they should use this fixture.
  • Loading branch information
robertschweizer committed Mar 23, 2023
1 parent 05c8d8c commit d22df2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
7 changes: 1 addition & 6 deletions tests/commands/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,5 @@ def config_customize():


@pytest.fixture()
def changelog_path() -> str:
def changelog_path(tmp_commitizen_project) -> str:
return os.path.join(os.getcwd(), "CHANGELOG.md")


@pytest.fixture()
def config_path() -> str:
return os.path.join(os.getcwd(), "pyproject.toml")
9 changes: 4 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ def tmp_git_project(tmpdir):

@pytest.fixture(scope="function")
def tmp_commitizen_project(tmp_git_project):
with tmp_git_project.as_cwd():
tmp_commitizen_cfg_file = tmp_git_project.join("pyproject.toml")
tmp_commitizen_cfg_file.write("[tool.commitizen]\n" 'version="0.1.0"\n')
tmp_commitizen_cfg_file = tmp_git_project.join("pyproject.toml")
tmp_commitizen_cfg_file.write("[tool.commitizen]\n" 'version="0.1.0"\n')

yield tmp_git_project
yield tmp_git_project


def _get_gpg_keyid(signer_mail):
Expand Down Expand Up @@ -71,5 +70,5 @@ def config():


@pytest.fixture()
def config_path() -> str:
def config_path(tmp_commitizen_project) -> str:
return os.path.join(os.getcwd(), "pyproject.toml")

0 comments on commit d22df2d

Please sign in to comment.