diff options
author | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-09 14:39:20 +0300 |
---|---|---|
committer | Arthur Zamarin <arthurzam@gentoo.org> | 2022-09-09 14:39:20 +0300 |
commit | 5ff74b735160b94ded789c4cf5bd269ad18717c4 (patch) | |
tree | 9e1c12d282abd6a7a64180acc903b6f1ce12ee4f /tests | |
parent | mask: add tests for invalid author (diff) | |
download | pkgdev-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.py | 23 |
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>', |