Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

TestOsOpsCommon is added [generic os_ops tests]#231

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Show file tree
Hide file tree
Changes from1 commit
Commits
Show all changes
11 commits
Select commitHold shift + click to select a range
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
PrevPrevious commit
NextNext commit
TestOsOpsCommon is updated
New tests:- test_rmdirs- test_rmdirs__01_with_subfolder- test_rmdirs__02_with_file- test_rmdirs__03_with_subfolder_and_file
  • Loading branch information
@dmitry-lipetsk
dmitry-lipetsk committedApr 2, 2025
commit9f60705c6090defbc24a24240f32b161ab535ec8
67 changes: 67 additions & 0 deletionstests/test_os_ops_common.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -225,6 +225,73 @@ def test_mkdtemp__custom(self, os_ops: OsOperations):
os.rmdir(path)
assert not os.path.exists(path)

def test_rmdirs(self, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

path = os_ops.mkdtemp()
assert os.path.exists(path)

assert os_ops.rmdirs(path, ignore_errors=False) is True
assert not os.path.exists(path)

def test_rmdirs__01_with_subfolder(self, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

# folder with subfolder
path = os_ops.mkdtemp()
assert os.path.exists(path)

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

os_ops.makedirs(dir1)
assert os.path.exists(dir1)

assert os_ops.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, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

# folder with file
path = os_ops.mkdtemp()
assert os.path.exists(path)

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

os_ops.touch(file1)
assert os.path.exists(file1)

assert os_ops.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, os_ops: OsOperations):
assert isinstance(os_ops, OsOperations)

# folder with subfolder and file
path = os_ops.mkdtemp()
assert os.path.exists(path)

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

os_ops.makedirs(dir1)
assert os.path.exists(dir1)

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

os_ops.touch(file1)
assert os.path.exists(file1)

assert os_ops.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_write_text_file(self, os_ops: OsOperations):
"""
Test write for writing data to a text file.
Expand Down
59 changes: 0 additions & 59 deletionstests/test_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,65 +17,6 @@ def setup(self):
ssh_key=os.getenv('RDBMS_TESTPOOL_SSHKEY'))
self.operations = RemoteOperations(conn_params)

def test_rmdirs(self):
path = self.operations.mkdtemp()
assert os.path.exists(path)

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

[8]ページ先頭

©2009-2025 Movatter.jp