Skip to content

Commit 135ddb3

Browse files
laumannarthurzam
authored andcommitted
pkgdev mask: Test both -r and --rites
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
1 parent 179509b commit 135ddb3

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

tests/scripts/test_pkgdev_mask.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -182,18 +182,20 @@ 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-
with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \
186-
patch('sys.argv', self.args + ['cat/pkg', '-r']), \
187-
pytest.raises(SystemExit), \
188-
chdir(pjoin(self.repo.path)):
189-
self.script()
190-
191185
removal_date = self.today + timedelta(days=30)
192186
today = self.today.strftime('%Y-%m-%d')
193187
removal = removal_date.strftime('%Y-%m-%d')
194-
assert self.masks_path.read_text() == textwrap.dedent(f"""\
195-
# First Last <first.last@email.com> ({today})
196-
# mask comment
197-
# Removal: {removal}
198-
cat/pkg
199-
""")
188+
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

0 commit comments

Comments
 (0)