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

Commit45cfbf7

Browse files
RemoteOperations::exec_command must not raise an exception when 'expect_error' is True (#159)
This commit fixes an issue#159.
1 parent22c649d commit45cfbf7

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

‎testgres/operations/remote_ops.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -83,26 +83,26 @@ def exec_command(self, cmd, wait_exit=False, verbose=False, expect_error=False,
8383

8484
exit_status=process.returncode
8585

86-
ifencoding:
87-
result=result.decode(encoding)
88-
error=error.decode(encoding)
89-
90-
ifexpect_error:
91-
raiseException(result,error)
86+
asserttype(result)==bytes# noqa: E721
87+
asserttype(error)==bytes# noqa: E721
9288

9389
ifnoterror:
94-
error_found=0
90+
error_found=False
9591
else:
96-
error=normalize_error(error)
9792
error_found=exit_status!=0orany(
98-
markerinerrorformarkerin ['error','Permission denied','fatal','No such file or directory']
93+
markerinerrorformarkerin [b'error',b'Permission denied',b'fatal',b'No such file or directory']
9994
)
10095

101-
ifnotignore_errorsanderror_found:
102-
ifisinstance(error,bytes):
103-
message=b"Utility exited with non-zero code. Error: "+error
104-
else:
105-
message=f"Utility exited with non-zero code. Error:{error}"
96+
asserttype(error_found)==bool# noqa: E721
97+
98+
ifencoding:
99+
result=result.decode(encoding)
100+
error=error.decode(encoding)
101+
102+
ifnotignore_errorsanderror_foundandnotexpect_error:
103+
error=normalize_error(error)
104+
asserttype(error)==str# noqa: E721
105+
message="Utility exited with non-zero code. Error: "+error
106106
raiseExecUtilException(message=message,command=cmd,exit_code=exit_status,out=result)
107107

108108
ifverbose:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp