Skip to content

Commit 9a135be

Browse files
use sys exit instead of builtins
1 parent 789d2e2 commit 9a135be

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ads/aqua/cli.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# Copyright (c) 2024 Oracle and/or its affiliates.
55
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
import os
7+
import sys
78

89
from ads.aqua import ENV_VAR_LOG_LEVEL, set_log_level, ODSC_MODEL_COMPARTMENT_OCID
910
from ads.aqua.deployment import AquaDeploymentApp
@@ -43,4 +44,4 @@ def __init__(
4344
set_log_level(log_level)
4445
# gracefully exit if env var is not set
4546
if not ODSC_MODEL_COMPARTMENT_OCID:
46-
exit()
47+
sys.exit(0)

tests/unitary/with_extras/aqua/test_cli.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,10 @@ def test_aquacommand(self, name, arg, expected, mock_setting_log):
5656
AquaCommand()
5757
mock_setting_log.assert_called_with(expected)
5858

59-
def test_aqua_command_without_compartment_env_var(self):
59+
@patch("sys.exit")
60+
def test_aqua_command_without_compartment_env_var(self, mock_exit):
6061
os.environ.pop("ODSC_MODEL_COMPARTMENT_OCID", None)
6162
reload(ads.aqua)
6263
reload(ads.aqua.cli)
63-
with pytest.raises(SystemExit):
64-
AquaCommand()
64+
AquaCommand()
65+
mock_exit.assert_called_with(0)

0 commit comments

Comments
 (0)