Skip to content
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

Add getter method for built executable #206

Merged
merged 1 commit into from
Nov 19, 2023
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
8 changes: 1 addition & 7 deletions benchcab/fluxsite.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,13 +264,7 @@ def fetch_files(self, verbose=False):
self.root_dir / internal.NAMELIST_DIR, task_dir, dirs_exist_ok=True
)

exe_src = (
self.root_dir
/ internal.SRC_DIR
/ self.repo.name
/ "offline"
/ internal.CABLE_EXE
)
exe_src = self.repo.get_exe_path()
exe_dest = task_dir / internal.CABLE_EXE

if verbose:
Expand Down
10 changes: 10 additions & 0 deletions benchcab/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,16 @@ def svn_info_show_item(self, item: str) -> str:
)
return proc.stdout.strip()

def get_exe_path(self) -> Path:
"""Return the path to the built executable."""
return (
self.root_dir
/ internal.SRC_DIR
/ self.name
/ "offline"
/ internal.CABLE_EXE
)

def custom_build(self, modules: list[str], verbose=False):
"""Build CABLE using a custom build script."""
build_script_path = (
Expand Down
11 changes: 11 additions & 0 deletions tests/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,17 @@ def test_undefined_repo_id(self, repo):
_ = repo.repo_id


class TestGetExePath:
"""Tests for `CableRepository.get_exe_path()`."""

def test_serial_exe_path(self, repo, mock_cwd):
"""Success case: get path to serial executable."""
assert (
repo.get_exe_path()
== mock_cwd / internal.SRC_DIR / repo.name / "offline" / internal.CABLE_EXE
)


class TestCheckout:
"""Tests for `Model.checkout()`."""

Expand Down