Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix mount points #59

Merged
merged 7 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion jupyterlite_xeus/add_on.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ def pack_prefix(self, kernel_dir):
)

host_path, mount_path = mount.split(":")
host_path = Path(host_path)
mount_path = Path(mount_path)

if not mount_path.is_absolute():
Expand All @@ -315,7 +316,7 @@ def pack_prefix(self, kernel_dir):
elif host_path.is_file():
pack_file(
host_file=host_path,
mount_file=mount_path,
mount_dir=mount_path,
outname=outname,
outdir=out_path,
)
Expand Down
27 changes: 27 additions & 0 deletions tests/test_xeus.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import os
from tempfile import TemporaryDirectory
from pathlib import Path
import tarfile

import pytest

Expand Down Expand Up @@ -77,3 +78,29 @@ def test_python_env_from_file_2():
with pytest.raises(RuntimeError, match="Cannot install binary PyPI package"):
for step in addon.post_build(manager):
pass


def test_mount_point():
app = LiteStatusApp(log_level="DEBUG")
app.initialize()
manager = app.lite_manager

addon = XeusAddon(manager)
addon.environment_file = "environment-1.yml"
addon.mounts = [
f"{(Path(__file__).parent / "environment-1.yml").resolve()}:/share",
f"{(Path(__file__).parent / "test_package").resolve()}:/share/test_package",
]

for step in addon.post_build(manager):
pass

outpath = Path(addon.cwd.name) / "packed_env"

with tarfile.open(outpath / "mount_0.tar.gz", "r") as fobj:
names = fobj.getnames()
assert "share/environment-1.yml" in names

with tarfile.open(outpath / "mount_1.tar.gz", "r") as fobj:
names = fobj.getnames()
assert "share/test_package/environment-3.yml" in names
Loading