Example #1
0
    def test_trash_empty_will_skip_unreadable_dir(self):
        out = StringIO()
        err = StringIO()

        make_unreadable_dir(self.unreadable_dir)

        empty(['trash-empty'], stdout = out, stderr = err,
                environ={'XDG_DATA_HOME':self.tmp_dir / 'data'})

        assert ("trash-empty: cannot remove %s\n"  % self.unreadable_dir ==
                     err.getvalue())
Example #2
0
    def test_trash_empty_will_crash_on_unreadable_directory_issue_48(self):
        out = StringIO()
        err = StringIO()
        mkdirs('data/Trash/files')
        mkdirs('data/Trash/files/unreadable')
        os.chmod('data/Trash/files/unreadable', 0o300)

        assert_true(os.path.exists('data/Trash/files/unreadable'))

        empty(['trash-empty'], stdout = out, stderr = err,
                environ={'XDG_DATA_HOME':'data'})

        assert_equal("trash-empty: cannot remove data/Trash/files/unreadable\n",
                     err.getvalue())
        os.chmod('data/Trash/files/unreadable', 0o700)
        shutil.rmtree('data')
Example #3
0
 def test(self):
     out = StringIO()
     empty(['trash-empty', '-h'], stdout = out)
     assert_regexp_matches(out.getvalue(), '^Usage. trash-empty.*')
Example #4
0
 def test(self):
     out = StringIO()
     empty(['trash-empty', '-h'], stdout=out)
     six.assertRegex(self, out.getvalue(), '^Usage. trash-empty.*')