Skip to content
Merged
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
21 changes: 18 additions & 3 deletions tests/cli/test_logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
# specific language governing permissions and limitations
# under the License.

from pathlib import Path
import subprocess
from unittest import mock

from hamilton import driver
from hamilton.cli import logic
Expand All @@ -24,9 +25,23 @@


def test_git_directory_exists():
git_base_dir = logic.get_git_base_directory()
completed_process = subprocess.CompletedProcess(
args=["git", "rev-parse", "--show-toplevel"],
returncode=0,
stdout="/tmp/fake-repo\n",
stderr="",
)

with mock.patch("subprocess.run", return_value=completed_process) as run_mock:
git_base_dir = logic.get_git_base_directory()

assert Path(git_base_dir).exists()
assert git_base_dir == "/tmp/fake-repo"
run_mock.assert_called_once_with(
["git", "rev-parse", "--show-toplevel"],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True,
)


def test_map_nodes_to_origins():
Expand Down
Loading