Skip to content

Expand user when setting install path #59

New issue

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

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

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion cadet/cadet.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def resolve_cadet_paths(
if install_path is None:
return None, None, None, None

install_path = Path(install_path)
install_path = Path(install_path).expanduser()

if install_path.is_file():
cadet_root = install_path.parent.parent
Expand Down
11 changes: 11 additions & 0 deletions tests/test_install_path_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

# Full path to cadet.dll or cadet.so, that is different from the system/conda cadet
full_path_dll = Path("path/to/cadet")
home_path_dll = Path("path/to/cadet")

install_path_conda = Cadet.autodetect_cadet()

Expand All @@ -22,6 +23,7 @@ def test_autodetection():
assert sim.cadet_cli_path.parent.parent == install_path_conda
assert sim.cadet_runner.cadet_path.suffix not in [".dll", ".so"]


@pytest.mark.local
def test_install_path():
if full_path_dll == Path("path/to/cadet"):
Expand All @@ -30,12 +32,21 @@ def test_install_path():
assert sim.cadet_dll_path == full_path_dll
assert sim.cadet_runner.cadet_path.suffix in [".dll", ".so"]

# Set root directory of CADET installation
sim = Cadet()
sim.install_path = full_path_dll.parent.parent
sim.use_dll = True
assert sim.cadet_dll_path == full_path_dll
assert sim.cadet_runner.cadet_path.suffix in [".dll", ".so"]

# Set root directory of CADET installation (with user home (`~`))
sim = Cadet()
sim.install_path = home_path_dll.parent.parent
sim.use_dll = True
assert sim.cadet_dll_path == full_path_dll
assert sim.cadet_runner.cadet_path.suffix in [".dll", ".so"]

# Set cli/dll path (deprecated)
sim = Cadet()
with pytest.deprecated_call():
sim.cadet_path = full_path_dll.parent.parent
Expand Down
Loading