aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorTim Harder <radhermit@gmail.com>2021-03-24 12:41:38 -0600
committerTim Harder <radhermit@gmail.com>2021-03-24 12:41:38 -0600
commit204e72b373ca0cad763467fd80356b96ce9536c5 (patch)
treeb60c5cf38edd9c5548e35f556d078e5c2914b293 /tests
parenttests: verify more `pkgdev mask` comment editing failures (diff)
downloadpkgdev-204e72b373ca0cad763467fd80356b96ce9536c5.tar.gz
pkgdev-204e72b373ca0cad763467fd80356b96ce9536c5.tar.bz2
pkgdev-204e72b373ca0cad763467fd80356b96ce9536c5.zip
tests: verify multiple `pkgdev mask` entries
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_mask.py30
1 files changed, 25 insertions, 5 deletions
diff --git a/tests/scripts/test_pkgdev_mask.py b/tests/scripts/test_pkgdev_mask.py
index 934411f..1d8b4d7 100644
--- a/tests/scripts/test_pkgdev_mask.py
+++ b/tests/scripts/test_pkgdev_mask.py
@@ -103,10 +103,13 @@ class TestPkgdevMask:
with open(pjoin(self.repo.location, 'profiles/profiles.desc'), 'w') as f:
f.write('amd64 arch/amd64 stable\n')
- profile = list(self.repo.config.profiles)[0]
- self.profile = self.repo.config.profiles.create_profile(profile)
self.masks_path = Path(pjoin(self.repo.location, 'profiles/package.mask'))
+ @property
+ def profile(self):
+ profile = list(self.repo.config.profiles)[0]
+ return self.repo.config.profiles.create_profile(profile)
+
def test_empty_repo(self):
assert self.profile.masks == frozenset()
@@ -120,7 +123,7 @@ class TestPkgdevMask:
assert err.strip() == "pkgdev mask: error: nonexistent editor: '12345'"
def test_failed_editor(self, capsys):
- with os_environ(EDITOR='sed'), \
+ with os_environ(EDITOR="sed -i 's///'"), \
patch('sys.argv', self.args + ['cat/pkg']), \
pytest.raises(SystemExit), \
chdir(pjoin(self.repo.path)):
@@ -140,8 +143,25 @@ class TestPkgdevMask:
def test_mask_cwd(self):
with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
patch('sys.argv', self.args), \
- pytest.raises(SystemExit) as excinfo, \
+ pytest.raises(SystemExit), \
chdir(pjoin(self.repo.path, 'cat/pkg')):
self.script()
- assert excinfo.value.code == 0
assert self.profile.masks == frozenset([atom_cls('cat/pkg')])
+
+ def test_mask_target(self):
+ with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
+ patch('sys.argv', self.args + ['=cat/pkg-0']), \
+ pytest.raises(SystemExit), \
+ chdir(pjoin(self.repo.path)):
+ self.script()
+ assert self.profile.masks == frozenset([atom_cls('=cat/pkg-0')])
+
+ # create a new pkg version and mask it as well
+ self.repo.create_ebuild('cat/pkg-1')
+ self.git_repo.add_all('cat/pkg-1')
+ with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
+ patch('sys.argv', self.args + ['=cat/pkg-1']), \
+ pytest.raises(SystemExit), \
+ chdir(pjoin(self.repo.path)):
+ self.script()
+ assert self.profile.masks == frozenset([atom_cls('=cat/pkg-0'), atom_cls('=cat/pkg-1')])