Exemple #1
0
def test_does_handle_missing_dependency_error(tmpdir, capsys):
    appdir = _create_app_structure(tmpdir)
    builder = mock.Mock(spec=DependencyBuilder)
    fake_package = mock.Mock(spec=Package)
    fake_package.identifier = 'foo==1.2'
    builder.build_site_packages.side_effect = MissingDependencyError(
        set([fake_package]))
    packager = LambdaDeploymentPackager(dependency_builder=builder)
    packager.create_deployment_package(str(appdir), 'python2.7')

    out, _ = capsys.readouterr()
    assert 'Could not install dependencies:\nfoo==1.2' in out
Exemple #2
0
def test_does_handle_missing_dependency_error(tmpdir):
    appdir = _create_app_structure(tmpdir)
    builder = mock.Mock(spec=DependencyBuilder)
    fake_package = mock.Mock(spec=Package)
    fake_package.identifier = 'foo==1.2'
    builder.build_site_packages.side_effect = MissingDependencyError(
        set([fake_package]))
    ui = mock.Mock(spec=chalice.utils.UI)
    osutils = chalice.utils.OSUtils()
    packager = LambdaDeploymentPackager(
        osutils=osutils,
        dependency_builder=builder,
        ui=ui,
    )
    packager.create_deployment_package(str(appdir), 'python2.7')

    output = ''.join([call[0][0] for call in ui.write.call_args_list])
    assert 'Could not install dependencies:\nfoo==1.2' in output