-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from MantisAI/feature/ui
Add `hugie ui` command (Fixes #30)
- Loading branch information
Showing
5 changed files
with
53 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[tool.poetry] | ||
name = "hugie" | ||
version = "0.3.1" | ||
version = "0.3.2" | ||
description = "CLI for managing Hugging Face Inference Endpoints" | ||
authors = ["Matthew Upson <[email protected]>", | ||
"Nick Sorros <[email protected]>"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from unittest.mock import Mock | ||
|
||
from hugie.__main__ import app | ||
from typer.testing import CliRunner | ||
|
||
runner = CliRunner() | ||
|
||
|
||
def test_ui_command(monkeypatch): | ||
mock_open = Mock( | ||
return_value="Opening https://ui.endpoints.huggingface.co/ in your browser..." | ||
) | ||
|
||
# Use monkeypatch to replace the ui function with the mock function | ||
monkeypatch.setattr("webbrowser.open", mock_open) | ||
|
||
runner = CliRunner() | ||
result = runner.invoke(app, ["ui"]) | ||
|
||
assert result.exit_code == 0 | ||
assert ( | ||
"Opening https://ui.endpoints.huggingface.co/ in your browser..." | ||
in result.output | ||
) | ||
|
||
# Check that the mock was called | ||
mock_open.assert_called() |