-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* switch to argparse * format * remove file first * update * remove comments
- Loading branch information
1 parent
6b5d43d
commit 92e19e5
Showing
4 changed files
with
62 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
fastapi >=0.100 | ||
httpx | ||
uvicorn[standard] >=0.29.0 | ||
jsonargparse[signatures]>=4.29.0 |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import pytest | ||
from litserve.__main__ import main | ||
import os | ||
|
||
|
||
def test_dockerize_help(monkeypatch, capsys): | ||
monkeypatch.setattr("sys.argv", ["litserve", "dockerize", "--help"]) | ||
# argparse calls sys.exit() after printing help | ||
with pytest.raises(SystemExit): | ||
main() | ||
captured = capsys.readouterr() | ||
assert "usage:" in captured.out, "CLI did not print help message" | ||
assert "The path to the server file." in captured.out, "CLI did not print help message" | ||
|
||
|
||
def test_dockerize_command(monkeypatch, capsys): | ||
# Assuming you have a dummy server file for testing | ||
dummy_server_file = "dummy_server.py" | ||
with open(dummy_server_file, "w") as f: | ||
f.write("# Dummy server file for testing\n") | ||
|
||
monkeypatch.setattr("sys.argv", ["litserve", "dockerize", dummy_server_file]) | ||
main() | ||
captured = capsys.readouterr() | ||
os.remove(dummy_server_file) | ||
assert "Dockerfile created successfully" in captured.out, "CLI did not create Dockerfile" | ||
assert os.path.exists("Dockerfile"), "CLI did not create Dockerfile" |