aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorThomas Bracht Laumann Jespersen <t@laumann.xyz>2022-04-13 17:29:33 +0200
committerArthur Zamarin <arthurzam@gmail.com>2022-04-13 20:12:19 +0300
commit4341308cff875f2ecdf35194253f698b37e1cde1 (patch)
tree1ac08bcde4f084cceebf7fc33848a0beb7b8e6d8 /tests
parentRelease version 0.2.0 (diff)
downloadpkgdev-4341308cff875f2ecdf35194253f698b37e1cde1.tar.gz
pkgdev-4341308cff875f2ecdf35194253f698b37e1cde1.tar.bz2
pkgdev-4341308cff875f2ecdf35194253f698b37e1cde1.zip
pkgdev mask: test optional days arg for -r/--rites
Diffstat (limited to 'tests')
-rw-r--r--tests/scripts/test_pkgdev_mask.py34
1 files changed, 18 insertions, 16 deletions
diff --git a/tests/scripts/test_pkgdev_mask.py b/tests/scripts/test_pkgdev_mask.py
index 21bf143..dcd0327 100644
--- a/tests/scripts/test_pkgdev_mask.py
+++ b/tests/scripts/test_pkgdev_mask.py
@@ -182,23 +182,25 @@ class TestPkgdevMask:
assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')])
def test_last_rites(self):
- removal_date = self.today + timedelta(days=30)
- today = self.today.strftime('%Y-%m-%d')
- removal = removal_date.strftime('%Y-%m-%d')
for rflag in ('-r', '--rites'):
- with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
- patch('sys.argv', self.args + ['cat/pkg', rflag]), \
- pytest.raises(SystemExit), \
- chdir(pjoin(self.repo.path)):
- self.script()
-
- assert self.masks_path.read_text() == textwrap.dedent(f"""\
- # First Last <first.last@email.com> ({today})
- # mask comment
- # Removal: {removal}
- cat/pkg
- """)
- self.masks_path.write_text("") # Reset the contents of package.mask
+ for args in ([rflag], [rflag, '14']):
+ with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
+ patch('sys.argv', self.args + ['cat/pkg'] + args), \
+ pytest.raises(SystemExit), \
+ chdir(pjoin(self.repo.path)):
+ self.script()
+
+ days = 30 if len(args) == 1 else int(args[1])
+ removal_date = self.today + timedelta(days=days)
+ today = self.today.strftime('%Y-%m-%d')
+ removal = removal_date.strftime('%Y-%m-%d')
+ assert self.masks_path.read_text() == textwrap.dedent(f"""\
+ # First Last <first.last@email.com> ({today})
+ # mask comment
+ # Removal: {removal}
+ cat/pkg
+ """)
+ self.masks_path.write_text("") # Reset the contents of package.mask
def test_mask_bugs(self):
removal_date = self.today + timedelta(days=30)