Cleanup: replace StringIO seek() & read() with a call to getvalue()
This commit is contained in:
parent
8709a51fa9
commit
5a761a47e1
@ -59,10 +59,8 @@ def url_prefill_from_blender(*, addon_info=None):
|
||||
"\n"
|
||||
)
|
||||
|
||||
fh.seek(0)
|
||||
|
||||
form_number = 2 if addon_info else 1
|
||||
return (
|
||||
"https://developer.blender.org/maniphest/task/edit/form/%i?description=" % form_number +
|
||||
urllib.parse.quote(fh.read())
|
||||
urllib.parse.quote(fh.getvalue())
|
||||
)
|
||||
|
@ -156,11 +156,8 @@ def execute(context, is_interactive):
|
||||
if _BPY_MAIN_OWN:
|
||||
sys.modules["__main__"] = main_mod_back
|
||||
|
||||
stdout.seek(0)
|
||||
stderr.seek(0)
|
||||
|
||||
output = stdout.read()
|
||||
output_err = stderr.read()
|
||||
output = stdout.getvalue()
|
||||
output_err = stderr.getvalue()
|
||||
|
||||
# cleanup
|
||||
sys.last_traceback = None
|
||||
|
@ -65,8 +65,7 @@ def expect_output_or_abort(*, fn, match_stderr=None, match_stdout=None):
|
||||
for (handle, match) in ((stdout, match_stdout), (stderr, match_stderr)):
|
||||
if not match:
|
||||
continue
|
||||
handle.seek(0)
|
||||
output = handle.read()
|
||||
output = handle.getvalue()
|
||||
if not re.match(match, output):
|
||||
print_fail_msg_and_exit("%r not found in %r" % (match, output))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user