File tree Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Expand file tree Collapse file tree 4 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+ """
4+
5+ __version__ = "1.2.2"
Original file line number Diff line number Diff line change 55import http
66import http .client
77import sys
8-
9- try :
10- from importlib import metadata
11- except ImportError :
12- # Running on pre-3.8 Python; use importlib-metadata package
13- import importlib_metadata as metadata
8+ from awslambdaric import __version__
149
1510
1611def _user_agent ():
1712 py_version = (
1813 f"{ sys .version_info .major } .{ sys .version_info .minor } .{ sys .version_info .micro } "
1914 )
20- try :
21- pkg_version = metadata .version ("awslambdaric" )
22- except :
23- pkg_version = "unknown"
15+ pkg_version = __version__
2416 return f"aws-lambda-python/{ py_version } -{ pkg_version } "
2517
2618
Original file line number Diff line number Diff line change 77import platform
88from subprocess import check_call , check_output
99from setuptools import Extension , find_packages , setup
10+ from awslambdaric import __version__
1011
1112
1213def get_curl_extra_linker_flags ():
@@ -68,7 +69,7 @@ def read_requirements(req="base.txt"):
6869
6970setup (
7071 name = "awslambdaric" ,
71- version = "1.2.1" ,
72+ version = __version__ ,
7273 author = "Amazon Web Services" ,
7374 description = "AWS Lambda Runtime Interface Client for Python" ,
7475 long_description = read ("README.md" ),
Original file line number Diff line number Diff line change 66import http .client
77import unittest .mock
88from unittest .mock import MagicMock , patch
9+ from awslambdaric import __version__
10+
911
1012from awslambdaric .lambda_runtime_client import (
1113 LambdaRuntimeClient ,
1214 LambdaRuntimeClientError ,
1315 InvocationRequest ,
16+ _user_agent ,
1417)
1518
1619
@@ -205,6 +208,9 @@ def test_invalid_addr(self):
205208 runtime_client = LambdaRuntimeClient ("::::" )
206209 runtime_client .post_init_error ("error" )
207210
211+ def test_lambdaric_version (self ):
212+ self .assertTrue (_user_agent ().endswith (__version__ ))
213+
208214
209215class TestLambdaRuntimeClientError (unittest .TestCase ):
210216 def test_constructor (self ):
You can’t perform that action at this time.
0 commit comments