From: Andrew Grimberg Date: Thu, 12 Oct 2023 19:34:38 +0000 (-0700) Subject: CI: Bring testing of lftools.cli.version to 100% X-Git-Tag: v0.37.7~4^2 X-Git-Url: https://gerrit.linuxfoundation.org/infra/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F57%2F72257%2F1;p=releng%2Flftools.git CI: Bring testing of lftools.cli.version to 100% Finish off the testing for lftools.cli.version Issue: RELENG-4944 Signed-off-by: Andrew Grimberg Change-Id: Id5ea7118f25e066c173b5a56f705d638f40689af --- diff --git a/lftools/cli/version.py b/lftools/cli/version.py index ec023e12..ca2932da 100644 --- a/lftools/cli/version.py +++ b/lftools/cli/version.py @@ -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) diff --git a/tests/test_version.py b/tests/test_version.py index 9a6e2880..bc50fdf5 100644 --- a/tests/test_version.py +++ b/tests/test_version.py @@ -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