Hack open function to write files in main thread #4455
Annotations
2 errors and 1 warning
Run tests:
src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideWorker.test.js#L110
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: StringMatching /pyodide_http.patch_all()/
Received
1: "
__old_input__ = input
def __patched_input__(prompt=False):
if (prompt):
print(prompt)
return __old_input__()
__builtins__.input = __patched_input__
"
2: "
import basthon
import builtins·
# Save the original open function
_original_open = builtins.open·
def _custom_open(filename, mode=\"r\", *args, **kwargs):
if \"w\" in mode or \"a\" in mode:
class CustomFile:
def __init__(self, filename):
self.filename = filename
self.content = \"\"·
def write(self, content):
self.content += content
# print(f\"{self.filename} {self.content}\")
basthon.kernel.display_event({ \"display_type\": \"file\", \"filename\": self.filename, \"content\": str({\"filename\": self.filename, \"content\": self.content}) })·
def close(self):
pass·
return CustomFile(filename)
else:
return _original_open(filename, mode, *args, **kwargs)·
# Override the built-in open function
builtins.open = _custom_open
"
Number of calls: 2
at Object.toHaveBeenCalledWith (/home/runner/work/editor-ui/editor-ui/src/components/Editor/Runners/PythonRunner/PyodideRunner/PyodideWorker.test.js:110:36)
|
Run tests
Process completed with exit code 1.
|
The following artifacts were uploaded using a version of actions/upload-artifact that is scheduled for deprecation: "cypress-artifacts".
Please update your workflow to use v4 of the artifact actions.
Learn more: https://github.blog/changelog/2024-04-16-deprecation-notice-v3-of-the-artifact-actions/
|
Loading