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

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

        assert os.path.isdir("sandbox/test-dir/sub-dir")
Пример #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')
Пример #9
0
    def test_dir_non_sticky(self):
        mkdirs(self.temp_dir / 'dir')

        assert not is_sticky_dir(self.temp_dir / 'dir')
Пример #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")
Пример #11
0
 def test_dir_sticky(self):
     mkdirs('sandbox/dir'); set_sticky_bit('sandbox/dir')
     assert is_sticky_dir('sandbox/dir')
Пример #12
0
 def test_dir_non_sticky(self):
     mkdirs('sandbox/dir'); assert not is_sticky_dir('sandbox/dir')
Пример #13
0
    def test_mkdirs_with_default_mode(self):

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

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