fix connect/ disconnect without arguments (#14877)

This commit is contained in:
Raphael Randschau 2022-09-26 20:43:36 -07:00 committed by GitHub
parent 9fd951b45c
commit 6edf5c5cc2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View File

@ -22,7 +22,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
### Fixed
-
- CLI usage without arguments errors ([#14877](https://github.com/Lightning-AI/lightning/pull/14877))
## [0.6.2] - 2022-09-21

View File

@ -50,7 +50,7 @@ def get_app_url(runtime_type: RuntimeType, *args: Any, need_credits: bool = Fals
def main() -> None:
# 1: Handle connection to a Lightning App.
if sys.argv[1] in ("connect", "disconnect"):
if len(sys.argv) > 1 and sys.argv[1] in ("connect", "disconnect"):
_main()
else:
# 2: Collect the connection a Lightning App.

View File

@ -49,6 +49,18 @@ def test_commands(command):
assert result.exit_code == 0
def test_main_lightning_cli_no_arguments():
"""Validate the Lightning CLI without args."""
res = os.popen("python -m lightning").read()
assert "login " in res
assert "logout " in res
assert "run " in res
assert "list " in res
assert "delete " in res
assert "create " in res
assert "show " in res
def test_main_lightning_cli_help():
"""Validate the Lightning CLI."""
res = os.popen("python -m lightning --help").read()