mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-04-20 02:39:02 +00:00
composer - make create-project idempotent, add force parameter (#11689)
* composer - make create-project idempotent, add force parameter Adds a check for an existing composer.json in working_dir before running create-project, so the task is skipped rather than failing on second run. A new force parameter allows bypassing this check when needed. Fixes #725. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * changelog fragment: rename to PR number, add PR URL Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
909458a661
commit
a4bba99203
4 changed files with 97 additions and 7 deletions
|
|
@ -9,6 +9,17 @@ from __future__ import annotations
|
|||
|
||||
from ansible_collections.community.general.plugins.modules import composer
|
||||
|
||||
from .uthelper import RunCommandMock, UTHelper
|
||||
from .uthelper import RunCommandMock, TestCaseMock, UTHelper
|
||||
|
||||
UTHelper.from_module(composer, __name__, mocks=[RunCommandMock])
|
||||
|
||||
class OsPathExistsMock(TestCaseMock):
|
||||
name = "os_path_exists"
|
||||
|
||||
def setup(self, mocker):
|
||||
mocker.patch("os.path.exists", return_value=self.mock_specs.get("return_value", False))
|
||||
|
||||
def check(self, test_case, results):
|
||||
pass
|
||||
|
||||
|
||||
UTHelper.from_module(composer, __name__, mocks=[RunCommandMock, OsPathExistsMock])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue