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

RemoteOperations::listdir is corrected#217

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 fromall commits
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
8 changes: 6 additions & 2 deletionstestgres/operations/remote_ops.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -277,8 +277,12 @@ def listdir(self, path):
Args:
path (str): The path to the directory.
"""
result = self.exec_command("ls {}".format(path))
return result.splitlines()
command = ["ls", path]
output = self.exec_command(cmd=command, encoding=get_default_encoding())
assert type(output) == str # noqa: E721
result = output.splitlines()
assert type(result) == list # noqa: E721
return result

def path_exists(self, path):
command = ["test", "-e", path]
Expand Down
11 changes: 11 additions & 0 deletionstests/test_local.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -87,6 +87,17 @@ def test_exec_command_failure__expect_error(self):
assert b"nonexistent_command" in error
assert b"not found" in error

def test_listdir(self):
"""
Test listdir for listing directory contents.
"""
path = "/etc"
files = self.operations.listdir(path)
assert isinstance(files, list)
for f in files:
assert f is not None
assert type(f) == str # noqa: E721

def test_read__text(self):
"""
Test LocalOperations::read for text data.
Expand Down
4 changes: 3 additions & 1 deletiontests/test_remote.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -222,8 +222,10 @@ def test_listdir(self):
"""
path = "/etc"
files = self.operations.listdir(path)

assert isinstance(files, list)
for f in files:
assert f is not None
assert type(f) == str # noqa: E721

def test_path_exists_true__directory(self):
"""
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp