def test_run_module_no_wait():
    with patch('sagemaker_containers._modules.download_and_install') as download_and_install:
        with patch('sagemaker_containers._modules.run') as run:
            _modules.run_module(uri='s3://url', args=['42'], cache=True, wait=False)

            download_and_install.assert_called_with('s3://url', 'default_user_module_name', True)
            run.assert_called_with('default_user_module_name', ['42'], {}, False)
def test_run_module_wait(download_and_extract, write_env_vars, install, run, wait, cache):
    with pytest.warns(DeprecationWarning):
        _modules.run_module(uri="s3://url", args=["42"], wait=wait, cache=cache)

        download_and_extract.assert_called_with("s3://url", _env.code_dir)
        write_env_vars.assert_called_with({})
        install.assert_called_with(_env.code_dir)

        run.assert_called_with("default_user_module_name", ["42"], {}, True, False)
Beispiel #3
0
def test_run_module_wait(download_and_extract, write_env_vars, install, run, wait, cache):
    with pytest.warns(DeprecationWarning):
        _modules.run_module(uri='s3://url', args=['42'], wait=wait, cache=cache)
        module_name = 'default_user_module_name'

        download_and_extract.assert_called_with('s3://url', module_name, _env.code_dir)
        write_env_vars.assert_called_with({})
        install.assert_called_with(_env.code_dir)

        run.assert_called_with('default_user_module_name', ['42'], {}, True, False)