Example #1
0
    def test_the_core_of_failures_for_issue_48(self):
        mkdirs('unreadable-dir')
        os.chmod('unreadable-dir', 0o300)

        assert_true(os.path.exists('unreadable-dir'))

        try:
            FileRemover().remove_file('unreadable-dir')
            assert False
        except OSError:
            pass

        os.chmod('unreadable-dir', 0o700)
        shutil.rmtree('unreadable-dir')
    def test_the_core_of_failures_for_issue_48(self):
        mkdirs('unreadable-dir')
        os.chmod('unreadable-dir', 0o300)

        assert_true(os.path.exists('unreadable-dir'))

        try:
            FileRemover().remove_file('unreadable-dir')
            assert False
        except OSError:
            pass

        os.chmod('unreadable-dir', 0o700)
        shutil.rmtree('unreadable-dir')
Example #3
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')
    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_equals("trash-empty: cannot remove data/Trash/files/unreadable\n",
                      err.getvalue())
        os.chmod('data/Trash/files/unreadable', 0o700)
        shutil.rmtree('data')
Example #5
0
 def test_dir_sticky(self):
     mkdirs('sandbox/dir')
     set_sticky_bit('sandbox/dir')
     assert is_sticky_dir('sandbox/dir')
Example #6
0
 def test_dir_non_sticky(self):
     mkdirs('sandbox/dir')
     assert not is_sticky_dir('sandbox/dir')
Example #7
0
    def test_mkdirs_with_default_mode(self):

        mkdirs("sandbox/test-dir/sub-dir")

        assert os.path.isdir("sandbox/test-dir/sub-dir")
Example #8
0
    def test_dir_sticky(self):
        mkdirs(self.temp_dir / 'dir')
        set_sticky_bit(self.temp_dir / 'dir')

        assert is_sticky_dir(self.temp_dir / 'dir')
Example #9
0
    def test_dir_non_sticky(self):
        mkdirs(self.temp_dir / 'dir')

        assert not is_sticky_dir(self.temp_dir / 'dir')
Example #10
0
    def test_mkdirs_with_default_mode(self):

        mkdirs(self.temp_dir / "test-dir/sub-dir")

        assert os.path.isdir(self.temp_dir / "test-dir/sub-dir")
 def test_dir_sticky(self):
     mkdirs('sandbox/dir'); set_sticky_bit('sandbox/dir')
     assert is_sticky_dir('sandbox/dir')
 def test_dir_non_sticky(self):
     mkdirs('sandbox/dir'); assert not is_sticky_dir('sandbox/dir')
    def test_mkdirs_with_default_mode(self):

        mkdirs("sandbox/test-dir/sub-dir")

        assert os.path.isdir("sandbox/test-dir/sub-dir")