Skip to content

Commit 9262b48

Browse files
committed
PR Feedback - Unit Test
1 parent b565428 commit 9262b48

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

src/sagemaker_pytorch_serving_container/torchserve.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from sagemaker_inference import default_handler_service, environment, logging, utils
2727
from sagemaker_inference.environment import code_dir
2828

29-
logger = logging.getLogger(__name__)
29+
logger = logging.get_logger()
3030

3131
TS_CONFIG_FILE = os.path.join("/etc", "sagemaker-ts.properties")
3232
DEFAULT_HANDLER_SERVICE = default_handler_service.__name__

test/unit/test_model_server.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def test_set_existing_python_path():
187187
def test_new_python_path():
188188
torchserve._set_python_path()
189189

190-
code_dir_path = "{}:".format(environment.code_dir)
190+
code_dir_path = environment.code_dir
191191

192192
assert os.environ[torchserve.PYTHON_PATH_ENV] == code_dir_path
193193

@@ -275,7 +275,8 @@ def test_add_sigterm_handler(signal_call):
275275
@patch("subprocess.check_call")
276276
def test_install_requirements(check_call):
277277
torchserve._install_requirements()
278-
278+
for i in ['pip', 'install', '-r', '/opt/ml/model/code/requirements.txt']:
279+
assert i in check_call.call_args.args[0]
279280

280281
@patch("subprocess.check_call", side_effect=subprocess.CalledProcessError(0, "cmd"))
281282
def test_install_requirements_installation_failed(check_call):
@@ -307,7 +308,7 @@ def test_retrieve_ts_server_process_no_server(process_iter, retry):
307308
with pytest.raises(Exception) as e:
308309
torchserve._retrieve_ts_server_process()
309310

310-
assert "ts model server was unsuccessfully started" in str(e.value)
311+
assert "Torchserve model server was unsuccessfully started" in str(e.value)
311312

312313

313314
@patch("retrying.Retrying.should_reject", return_value=False)

0 commit comments

Comments
 (0)