aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2022-09-09 14:39:20 +0300
committerArthur Zamarin <arthurzam@gentoo.org>2022-09-09 14:39:20 +0300
commit5ff74b735160b94ded789c4cf5bd269ad18717c4 (patch)
tree9e1c12d282abd6a7a64180acc903b6f1ce12ee4f /tests
parentmask: add tests for invalid author (diff)
downloadpkgdev-5ff74b735160b94ded789c4cf5bd269ad18717c4.tar.gz
pkgdev-5ff74b735160b94ded789c4cf5bd269ad18717c4.tar.bz2
pkgdev-5ff74b735160b94ded789c4cf5bd269ad18717c4.zip
mask: improve parsing of empty header line
If the header of mask had a break, which looked like `#`, it would fail to parse, which is somewhat wrong. So add it as exception. Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_mask.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/scripts/test_pkgdev_mask.py b/tests/scripts/test_pkgdev_mask.py
index 88898c0..aff8c89 100644
--- a/tests/scripts/test_pkgdev_mask.py
+++ b/tests/scripts/test_pkgdev_mask.py
@@ -194,6 +194,29 @@ class TestPkgdevMask:
self.script()
assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')])
+ def test_invalid_header(self, capsys):
+ self.masks_path.write_text(textwrap.dedent("""\
+ # Random Dev <random.dev@email.com> (2022-09-09)
+ #
+ # Larry the Cow was here
+ #
+ # masked
+ cat/masked
+
+ # Larry the Cow <larry@gentoo.org> (2022-09-09)
+ #test
+ # Larry the Cow wasn't here
+ cat/masked2
+ """))
+
+ 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()
+ _, err = capsys.readouterr()
+ assert 'invalid mask entry header, lineno 9' in err
+
def test_invalid_author(self, capsys):
for line in (
'# Random Dev <random.dev@email.com>',