8000 os_ops::rmdirs (local, remote) was refactored by dmitry-lipetsk · Pull Request #207 · postgrespro/testgres · GitHub
[go: up one dir, main page]

Skip to content

os_ops::rmdirs (local, remote) was refactored #207

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[TestRemoteOperations] New tests for rmdirs are added.
  • Loading branch information
dmitry-lipetsk committed Mar 3, 2025
commit 174d6e6442d7e663f79b45b9477e0684fda8d9ce
52 changes: 52 additions & 0 deletions tests/test_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,58 @@ def test_rmdirs(self):
assert self.operations.rmdirs(path, ignore_errors=False) is True
assert not os.path.exists(path)

def test_rmdirs__01_with_subfolder(self):
# folder with subfolder
path = self.operations.mkdtemp()
assert os.path.exists(path)

dir1 = os.path.join(path, "dir1")
assert not os.path.exists(dir1)

self.operations.makedirs(dir1)
assert os.path.exists(dir1)

assert self.operations.rmdirs(path, ignore_errors=False) is True
assert not os.path.exists(path)
assert not os.path.exists(dir1)

def test_rmdirs__02_with_file(self):
# folder with file
path = self.operations.mkdtemp()
assert os.path.exists(path)

file1 = os.path.join(path, "file1.txt")
assert not os.path.exists(file1)

self.operations.touch(file1)
assert os.path.exists(file1)

assert self.operations.rmdirs(path, ignore_errors=False) is True
assert not os.path.exists(path)
assert not os.path.exists(file1)

def test_rmdirs__03_with_subfolder_and_file(self):
# folder with subfolder and file
path = self.operations.mkdtemp()
assert os.path.exists(path)

dir1 = os.path.join(path, "dir1")
assert not os.path.exists(dir1)

self.operations.makedirs(dir1)
assert os.path.exists(dir1)

file1 = os.path.join(dir1, "file1.txt")
assert not os.path.exists(file1)

self.operations.touch(file1)
assert os.path.exists(file1)

assert self.operations.rmdirs(path, ignore_errors=False) is True
assert not os.path.exists(path)
assert not os.path.exists(dir1)
assert not os.path.exists(file1)

def test_rmdirs__try_to_delete_nonexist_path(self):
path = "/root/test_dir"

Expand Down
0