def test_set_writable(self): _test = File('{}/test.txt'.format(_TEST_DIR)) print "TEST FILE", _test if _test.exists(): _test.set_writable(True) _test.delete(force=True) _test.touch() assert _test.is_writable() print _test.set_writable(False) assert not _test.is_writable() _test.set_writable(True) _test.delete(force=True)
def test_move_to(self): _file_a = File(abs_path( '{}/A/file.text'.format(tempfile.gettempdir()))) _file_b = File(abs_path( '{}/B/file.text'.format(tempfile.gettempdir()))) _file_a.touch() _dir = _file_a.parent() print _dir _file_a.parent().move_to(_file_b.parent()) assert _file_b.exists() _file_b.parent().delete(force=True) assert not _file_b.parent().exists()
def test_delete(self): _tmp = File('{}/test.file'.format(tempfile.gettempdir())) _tmp.touch() _tmp.delete(catch=True, force=True)