aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2021-03-05 01:31:18 -0700
committerTim Harder <radhermit@gmail.com>2021-03-05 01:31:18 -0700
commitea65cd254647d5593adcf3348c9c28e2eee759c2 (patch)
tree3d2e26245ea3e8f72f4ece3a8cbf8c2f2fc3d36a /tests
parentpkgdev manifest: minor namespace tweaks for easier testing (diff)
downloadpkgdev-ea65cd254647d5593adcf3348c9c28e2eee759c2.tar.gz
pkgdev-ea65cd254647d5593adcf3348c9c28e2eee759c2.tar.bz2
pkgdev-ea65cd254647d5593adcf3348c9c28e2eee759c2.zip
tests: verify exit codes for various `pkgdev commit` parsing failures
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_commit.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/tests/scripts/test_pkgdev_commit.py b/tests/scripts/test_pkgdev_commit.py
index 3f6e3f6..0858f79 100644
--- a/tests/scripts/test_pkgdev_commit.py
+++ b/tests/scripts/test_pkgdev_commit.py
@@ -15,16 +15,18 @@ from snakeoil.osutils import pjoin
class TestPkgdevCommitParseArgs:
def test_non_repo_cwd(self, capsys, tool):
- with pytest.raises(SystemExit):
+ with pytest.raises(SystemExit) as excinfo:
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')
def test_non_git_repo_cwd(self, repo, capsys, tool):
- with pytest.raises(SystemExit), \
+ with pytest.raises(SystemExit) as excinfo, \
chdir(repo.location):
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')
@@ -32,9 +34,10 @@ class TestPkgdevCommitParseArgs:
def test_non_ebuild_git_repo_cwd(self, make_repo, git_repo, capsys, tool):
os.mkdir(pjoin(git_repo.path, 'repo'))
repo = make_repo(pjoin(git_repo.path, 'repo'))
- with pytest.raises(SystemExit), \
+ with pytest.raises(SystemExit) as excinfo, \
chdir(repo.location):
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')