コード例 #1
0
def test_default_version_range_locks_minor_version():
    parts = [int(p) for p in chalice_version.split('.')]
    min_version = '%s.%s.%s' % (parts[0], parts[1], 0)
    max_version = '%s.%s.%s' % (parts[0], parts[1] + 1, 0)
    params = pipeline.PipelineParameters('appname', 'python2.7')
    assert params.chalice_version_range == '>=%s,<%s' % (min_version,
                                                         max_version)
コード例 #2
0
    def setup_once():
        # type: () -> None
        try:
            version = tuple(map(int, CHALICE_VERSION.split(".")[:3]))
        except (ValueError, TypeError):
            raise DidNotEnable(
                "Unparsable Chalice version: {}".format(CHALICE_VERSION))
        if version < (1, 20):
            old_get_view_function_response = Chalice._get_view_function_response
        else:
            from chalice.app import RestAPIEventHandler

            old_get_view_function_response = (
                RestAPIEventHandler._get_view_function_response)

        def sentry_event_response(app, view_function, function_args):
            # type: (Any, F, Dict[str, Any]) -> Any
            wrapped_view_function = _get_view_function_response(
                app, view_function, function_args)

            return old_get_view_function_response(app, wrapped_view_function,
                                                  function_args)

        if version < (1, 20):
            Chalice._get_view_function_response = sentry_event_response
        else:
            RestAPIEventHandler._get_view_function_response = sentry_event_response
        # for everything else (like events)
        chalice.app.EventSourceHandler = EventSourceHandler
コード例 #3
0
ファイル: test_pipeline.py プロジェクト: awslabs/chalice
def test_default_version_range_locks_minor_version():
    parts = [int(p) for p in chalice_version.split('.')]
    min_version = '%s.%s.%s' % (parts[0], parts[1], 0)
    max_version = '%s.%s.%s' % (parts[0], parts[1] + 1, 0)
    params = pipeline.PipelineParameters('appname', 'python2.7')
    assert params.chalice_version_range == '>=%s,<%s' % (
        min_version, max_version
    )
コード例 #4
0
 def _lock_to_minor_version(self):
     # type: () -> str
     parts = [int(p) for p in chalice_version.split('.')]
     min_version = '%s.%s.%s' % (parts[0], parts[1], 0)
     max_version = '%s.%s.%s' % (parts[0], parts[1] + 1, 0)
     return '>=%s,<%s' % (min_version, max_version)
コード例 #5
0
ファイル: pipeline.py プロジェクト: awslabs/chalice
 def _lock_to_minor_version(self):
     # type: () -> str
     parts = [int(p) for p in chalice_version.split('.')]
     min_version = '%s.%s.%s' % (parts[0], parts[1], 0)
     max_version = '%s.%s.%s' % (parts[0], parts[1] + 1, 0)
     return '>=%s,<%s' % (min_version, max_version)