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

Commit230e562

Browse files
RemoteOperations::listdir is corrected (#217)
- It returns list[str]- New asserts are addedTests for listdir are updated.
1 parente3eb6ae commit230e562

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

‎testgres/operations/remote_ops.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,12 @@ def listdir(self, path):
277277
Args:
278278
path (str): The path to the directory.
279279
"""
280-
result=self.exec_command("ls {}".format(path))
281-
returnresult.splitlines()
280+
command= ["ls",path]
281+
output=self.exec_command(cmd=command,encoding=get_default_encoding())
282+
asserttype(output)==str# noqa: E721
283+
result=output.splitlines()
284+
asserttype(result)==list# noqa: E721
285+
returnresult
282286

283287
defpath_exists(self,path):
284288
command= ["test","-e",path]

‎tests/test_local.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,17 @@ def test_exec_command_failure__expect_error(self):
8787
assertb"nonexistent_command"inerror
8888
assertb"not found"inerror
8989

90+
deftest_listdir(self):
91+
"""
92+
Test listdir for listing directory contents.
93+
"""
94+
path="/etc"
95+
files=self.operations.listdir(path)
96+
assertisinstance(files,list)
97+
forfinfiles:
98+
assertfisnotNone
99+
asserttype(f)==str# noqa: E721
100+
90101
deftest_read__text(self):
91102
"""
92103
Test LocalOperations::read for text data.

‎tests/test_remote.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ def test_listdir(self):
222222
"""
223223
path="/etc"
224224
files=self.operations.listdir(path)
225-
226225
assertisinstance(files,list)
226+
forfinfiles:
227+
assertfisnotNone
228+
asserttype(f)==str# noqa: E721
227229

228230
deftest_path_exists_true__directory(self):
229231
"""

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp