Avoid OOM in doctest CI (#24139)
* fix * fix --------- Co-authored-by: ydshieh <ydshieh@users.noreply.github.com>
This commit is contained in:
@@ -1870,9 +1870,18 @@ def preprocess_string(string, skip_cuda_tests):
|
||||
):
|
||||
is_cuda_found = True
|
||||
break
|
||||
|
||||
modified_string = ""
|
||||
if not is_cuda_found:
|
||||
modified_string = "".join(codeblocks)
|
||||
|
||||
if ">>>" in modified_string:
|
||||
lines = modified_string.split("\n")
|
||||
indent = len(lines[-1]) - len(lines[-1].lstrip())
|
||||
|
||||
cleanup = ">>> import gc; gc.collect() # doctest: +IGNORE_RESULT"
|
||||
modified_string += "\n" + " " * indent + cleanup
|
||||
|
||||
return modified_string
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user