diff --git a/jupyterlite_xeus/add_on.py b/jupyterlite_xeus/add_on.py index 1b6b148..4e5947c 100644 --- a/jupyterlite_xeus/add_on.py +++ b/jupyterlite_xeus/add_on.py @@ -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(): @@ -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, ) diff --git a/tests/test_xeus.py b/tests/test_xeus.py index 70cdd48..eafc3a4 100644 --- a/tests/test_xeus.py +++ b/tests/test_xeus.py @@ -3,6 +3,7 @@ import os from tempfile import TemporaryDirectory from pathlib import Path +import tarfile import pytest @@ -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