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