Add test for EXTRA_MOUNTS (#3812)

This commit is contained in:
Hood Chatham 2023-05-01 11:42:21 -07:00 committed by GitHub
parent 57789c64bb
commit 4c24bd7183
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 26 additions and 0 deletions

View File

@ -145,6 +145,32 @@ Try `python -h' for more information.
)
@only_node
def test_extra_mounts(selenium, tmp_path, monkeypatch):
dir_a = tmp_path / "a"
dir_b = tmp_path / "b"
dir_a.mkdir()
dir_b.mkdir()
tmp_path_a = dir_a / "script.py"
tmp_path_b = dir_b / "script.py"
tmp_path_a.write_text("print('hello 1')")
tmp_path_b.write_text("print('hello 2')")
monkeypatch.setenv("_PYODIDE_EXTRA_MOUNTS", f"{dir_a}:{dir_b}")
result = subprocess.run(
[script_path, tmp_path_a], capture_output=True, encoding="utf8"
)
assert result.returncode == 0
assert result.stdout == "hello 1\n"
assert result.stderr == ""
result = subprocess.run(
[script_path, tmp_path_b], capture_output=True, encoding="utf8"
)
assert result.returncode == 0
assert result.stdout == "hello 2\n"
assert result.stderr == ""
@contextmanager
def venv_ctxmgr(path):
check_emscripten()