diff options
author | Tim Harder <radhermit@gmail.com> | 2021-03-05 05:21:24 -0700 |
---|---|---|
committer | Tim Harder <radhermit@gmail.com> | 2021-03-05 05:21:24 -0700 |
commit | 40347725268db846f935df0cd65c4c4b70a08246 (patch) | |
tree | 42bb09536c6c47e1e75ebed7854df87ca23f9dea /tests | |
parent | git: add generic GitError exception (diff) | |
download | pkgdev-40347725268db846f935df0cd65c4c4b70a08246.tar.gz pkgdev-40347725268db846f935df0cd65c4c4b70a08246.tar.bz2 pkgdev-40347725268db846f935df0cd65c4c4b70a08246.zip |
pkgdev: various argparse-related rework
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scripts/test_pkgdev_commit.py | 9 | ||||
-rw-r--r-- | tests/scripts/test_pkgdev_manifest.py | 3 | ||||
-rw-r--r-- | tests/scripts/test_pkgdev_push.py | 9 |
3 files changed, 7 insertions, 14 deletions
diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py index 40f5afa..de8d6f0 100644 --- a/tests/scripts/test_pkgdev_commit.py +++ b/tests/scripts/test_pkgdev_commit.py @@ -19,8 +19,7 @@ class TestPkgdevCommitParseArgs: tool.parse_args(['commit']) assert excinfo.value.code == 2 out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in ebuild repo') + assert err.strip() == 'pkgdev commit: error: not in ebuild repo' def test_non_git_repo_cwd(self, repo, capsys, tool): with pytest.raises(SystemExit) as excinfo, \ @@ -28,8 +27,7 @@ class TestPkgdevCommitParseArgs: tool.parse_args(['commit']) assert excinfo.value.code == 2 out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in git repo') + assert err.strip() == 'pkgdev commit: error: not in git repo' def test_non_ebuild_git_repo_cwd(self, make_repo, git_repo, capsys, tool): os.mkdir(pjoin(git_repo.path, 'repo')) @@ -39,8 +37,7 @@ class TestPkgdevCommitParseArgs: tool.parse_args(['commit']) assert excinfo.value.code == 2 out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in ebuild git repo') + assert err.strip() == 'pkgdev commit: error: not in ebuild git repo' def test_git_commit_args(self, repo, make_git_repo, tool): git_repo = make_git_repo(repo.location) diff --git a/tests/scripts/test_pkgdev_manifest.py b/tests/scripts/test_pkgdev_manifest.py index b8a8177..1131ff7 100644 --- a/tests/scripts/test_pkgdev_manifest.py +++ b/tests/scripts/test_pkgdev_manifest.py @@ -14,8 +14,7 @@ class TestPkgdevManifestParseArgs: tool.parse_args(['manifest']) assert excinfo.value.code == 2 out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in ebuild repo') + assert err.strip() == 'pkgdev manifest: error: not in ebuild repo' def test_repo_cwd(self, repo, capsys, tool): repo.create_ebuild('cat/pkg-0') diff --git a/tests/scripts/test_pkgdev_push.py b/tests/scripts/test_pkgdev_push.py index 3aa81d7..72419c2 100644 --- a/tests/scripts/test_pkgdev_push.py +++ b/tests/scripts/test_pkgdev_push.py @@ -15,16 +15,14 @@ class TestPkgdevPushParseArgs: with pytest.raises(SystemExit): tool.parse_args(['push']) out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in ebuild repo') + assert err.strip() == 'pkgdev push: error: not in ebuild repo' def test_non_git_repo_cwd(self, repo, capsys, tool): with pytest.raises(SystemExit), \ chdir(repo.location): tool.parse_args(['push']) out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in git repo') + assert err.strip() == 'pkgdev push: error: not in git repo' def test_non_ebuild_git_repo_cwd(self, make_repo, git_repo, capsys, tool): os.mkdir(pjoin(git_repo.path, 'repo')) @@ -33,8 +31,7 @@ class TestPkgdevPushParseArgs: chdir(repo.location): tool.parse_args(['push']) out, err = capsys.readouterr() - err = err.strip().split('\n')[-1] - assert err.endswith('error: not in ebuild git repo') + assert err.strip() == 'pkgdev push: error: not in ebuild git repo' def test_git_push_args_passthrough(self, repo, make_git_repo, tool): """Unknown arguments for ``pkgdev push`` are passed to ``git push``.""" |