Skip to content

Commit 4341308

Browse files
laumannarthurzam
authored andcommitted
pkgdev mask: test optional days arg for -r/--rites
1 parent 1656e9c commit 4341308

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

tests/scripts/test_pkgdev_mask.py

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,25 @@ def test_existing_masks(self):
182182
assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')])
183183

184184
def test_last_rites(self):
185-
removal_date = self.today + timedelta(days=30)
186-
today = self.today.strftime('%Y-%m-%d')
187-
removal = removal_date.strftime('%Y-%m-%d')
188185
for rflag in ('-r', '--rites'):
189-
with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
190-
patch('sys.argv', self.args + ['cat/pkg', rflag]), \
191-
pytest.raises(SystemExit), \
192-
chdir(pjoin(self.repo.path)):
193-
self.script()
194-
195-
assert self.masks_path.read_text() == textwrap.dedent(f"""\
196-
# First Last <first.last@email.com> ({today})
197-
# mask comment
198-
# Removal: {removal}
199-
cat/pkg
200-
""")
201-
self.masks_path.write_text("") # Reset the contents of package.mask
186+
for args in ([rflag], [rflag, '14']):
187+
with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
188+
patch('sys.argv', self.args + ['cat/pkg'] + args), \
189+
pytest.raises(SystemExit), \
190+
chdir(pjoin(self.repo.path)):
191+
self.script()
192+
193+
days = 30 if len(args) == 1 else int(args[1])
194+
removal_date = self.today + timedelta(days=days)
195+
today = self.today.strftime('%Y-%m-%d')
196+
removal = removal_date.strftime('%Y-%m-%d')
197+
assert self.masks_path.read_text() == textwrap.dedent(f"""\
198+
# First Last <first.last@email.com> ({today})
199+
# mask comment
200+
# Removal: {removal}
201+
cat/pkg
202+
""")
203+
self.masks_path.write_text("") # Reset the contents of package.mask
202204

203205
def test_mask_bugs(self):
204206
removal_date = self.today + timedelta(days=30)

0 commit comments

Comments
 (0)