MCPcopy
hub / github.com/pyodide/pyodide / create_test_file

Function create_test_file

src/tests/test_filesystem.py:33–45  ·  view source on GitHub ↗
(selenium_module, mount_dir)

Source from the content-addressed store, hash-verified

31
32 @run_in_pyodide
33 def create_test_file(selenium_module, mount_dir):
34 import sys
35 from importlib import invalidate_caches
36 from pathlib import Path
37
38 p = Path(f"{mount_dir}/test_idbfs/__init__.py")
39 p.parent.mkdir(exist_ok=True, parents=True)
40 p.write_text("def test(): return 7")
41 invalidate_caches()
42 sys.path.append(mount_dir)
43 from test_idbfs import test
44
45 assert test() == 7
46
47 create_test_file(selenium, mount_dir)
48 # sync TO idbfs

Callers 1

test_idbfs_persist_codeFunction · 0.85

Calls 3

write_textMethod · 0.80
testFunction · 0.70
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…