Skip to content

Commit

Permalink
CI: Bring testing of lftools.cli.version to 100%
Browse files Browse the repository at this point in the history
Finish off the testing for lftools.cli.version

Issue: RELENG-4944
Signed-off-by: Andrew Grimberg <agrimberg@linuxfoundation.org>
Change-Id: Id5ea7118f25e066c173b5a56f705d638f40689af
  • Loading branch information
tykeal committed Oct 12, 2023
1 parent 955ce28 commit 04d953f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lftools/cli/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,9 @@ def patch(ctx, release_tag, patch_dir, project):
if not os.path.isdir(patch_dir):
log.error("{} is not a valid directory.".format(patch_dir))
sys.exit(404)
status = subprocess.call(["version", "patch", release_tag, patch_dir, project])
sys.exit(status)
# due to the nature of the subprocess call, this is not testable so disable coverage
status = subprocess.call(["version", "patch", release_tag, patch_dir, project]) # pragma: no cover
sys.exit(status) # pragma: no cover


version.add_command(bump)
Expand Down
10 changes: 10 additions & 0 deletions tests/test_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,13 @@ def test_version_release(cli_runner, datafiles):
expected_pom = str(_file) + "/pom.xml.expected"
# noqa: B101 .
assert filecmp.cmp(pom, expected_pom)


@pytest.mark.datafiles(
os.path.join(FIXTURE_DIR, "version_bump", "release"),
)
def test_patch(cli_runner, datafiles):
"""Test patch command."""
os.chdir(str(datafiles))
result = cli_runner.invoke(cli.cli, ["version", "patch", "TestRelease", os.path.join(datafiles, "README")], obj={})
assert result.exit_code == 404

0 comments on commit 04d953f

Please sign in to comment.