aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2021-03-05 01:31:41 -0700
committerTim Harder <radhermit@gmail.com>2021-03-05 01:31:41 -0700
commitab95e006786381012680943a25a8438558038f76 (patch)
treee4ca9d0a4f40e49c59efdef21c6d0f77d0695cac /tests
parenttests: verify exit codes for various `pkgdev commit` parsing failures (diff)
downloadpkgdev-ab95e006786381012680943a25a8438558038f76.tar.gz
pkgdev-ab95e006786381012680943a25a8438558038f76.tar.bz2
pkgdev-ab95e006786381012680943a25a8438558038f76.zip
tests: add more `pkgdev manifest` restriction parsing tests
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_manifest.py22
1 files changed, 21 insertions, 1 deletions
diff --git a/tests/scripts/test_pkgdev_manifest.py b/tests/scripts/test_pkgdev_manifest.py
index c165ef1..21c8124 100644
--- a/tests/scripts/test_pkgdev_manifest.py
+++ b/tests/scripts/test_pkgdev_manifest.py
@@ -2,6 +2,7 @@ from functools import partial
from unittest.mock import patch
import pytest
+from pkgcore.ebuild.atom import atom as atom_cls
from pkgdev.scripts import run
from snakeoil.contexts import chdir
@@ -9,12 +10,31 @@ from snakeoil.contexts import chdir
class TestPkgdevManifestParseArgs:
def test_non_repo_cwd(self, capsys, tool):
- with pytest.raises(SystemExit):
+ with pytest.raises(SystemExit) as excinfo:
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')
+ def test_repo_cwd(self, repo, capsys, tool):
+ with chdir(repo.location):
+ options, _ = tool.parse_args(['manifest'])
+ assert options.restrictions
+
+ def test_atom_target(self, repo, capsys, tool):
+ with chdir(repo.location):
+ options, _ = tool.parse_args(['manifest', 'cat/pkg'])
+ assert options.restrictions == [atom_cls('cat/pkg')]
+
+ def test_invalid_atom_target(self, repo, capsys, tool):
+ with pytest.raises(SystemExit) as excinfo, \
+ chdir(repo.location):
+ tool.parse_args(['manifest', '=cat/pkg'])
+ assert excinfo.value.code == 2
+ out, err = capsys.readouterr()
+ err == "pkgdev manifest: error: invalid atom: '=cat/pkg'"
+
class TestPkgdevManifest: