MCPcopy
hub / github.com/pyodide/pyodide / test_windows_to_linux_path_import

Function test_windows_to_linux_path_import

src/tests/test_pyodide.py:1606–1633  ·  view source on GitHub ↗
(selenium_standalone)

Source from the content-addressed store, hash-verified

1604
1605@run_in_pyodide
1606def test_windows_to_linux_path_import(selenium_standalone):
1607 import sys
1608 from importlib import invalidate_caches
1609 from pathlib import Path
1610
1611 tmp_dir = Path("/tmp/my/temporary/directory/for/testing/import")
1612 tmp_dir.mkdir(parents=True, exist_ok=True)
1613 module_file = tmp_dir / "test_module.py"
1614
1615 sys.path.append("C:\\tmp\\my\\temporary\\directory\\for\\testing\\import")
1616 invalidate_caches()
1617
1618 try:
1619 import test_module
1620
1621 raise AssertionError("Module should not be found yet")
1622 except ModuleNotFoundError:
1623 pass
1624
1625 module_file.write_text("TEST_VALUE = 456")
1626
1627 import test_module
1628
1629 assert test_module.TEST_VALUE == 456
1630
1631 # cleanup
1632 module_file.unlink()
1633 tmp_dir.rmdir()
1634
1635
1636def test_args(selenium_standalone_noload):

Callers

nothing calls this directly

Calls 2

write_textMethod · 0.80
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…