From 135ddb364f445cb3c017305eb90c89db31dbfdb0 Mon Sep 17 00:00:00 2001 From: Thomas Bracht Laumann Jespersen Date: Tue, 29 Mar 2022 15:38:35 +0200 Subject: pkgdev mask: Test both -r and --rites Signed-off-by: Thomas Bracht Laumann Jespersen --- tests/scripts/test_pkgdev_mask.py | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) (limited to 'tests') diff --git a/tests/scripts/test_pkgdev_mask.py b/tests/scripts/test_pkgdev_mask.py index a5eddf7..557265b 100644 --- a/tests/scripts/test_pkgdev_mask.py +++ b/tests/scripts/test_pkgdev_mask.py @@ -182,18 +182,20 @@ class TestPkgdevMask: assert self.profile.masks == frozenset([atom_cls('cat/masked'), atom_cls('=cat/pkg-0')]) def test_last_rites(self): - with os_environ(EDITOR="sed -i '1s/$/mask comment/'"), \ - patch('sys.argv', self.args + ['cat/pkg', '-r']), \ - pytest.raises(SystemExit), \ - chdir(pjoin(self.repo.path)): - self.script() - removal_date = self.today + timedelta(days=30) 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 ({today}) - # mask comment - # Removal: {removal} - cat/pkg - """) + 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 ({today}) + # mask comment + # Removal: {removal} + cat/pkg + """) + self.masks_path.write_text("") # Reset the contents of package.mask -- cgit v1.2.3-65-gdbad