11from unittest import TestCase
2+ from osbot_utils .utils .Env import in_github_action
23from osbot_utils .utils .Zip import zip_bytes__file_list , zip_bytes__files
34from osbot_aws .AWS_Config import AWS_Config , DEFAULT__BUCKET_NAME__INFIX__LAMBDA
45from osbot_aws .aws .lambda_ .schemas .Safe_Str__File__Name__Python_Package import Safe_Str__File__Name__Python_Package
@@ -44,12 +45,24 @@ def test__1__setup(self):
4445
4546 def test__2__install (self ):
4647 with self .lambda_dependency_local as _ :
47- target_path = str (_ .path ())
48- install_data = _ .install ()
49- assert type (install_data ) is Schema__Lambda__Dependency__Local_Install__Data
50- assert _ .install__data__exists () is True
51- assert folder_exists (target_path ) is True
52- assert install_data .obj () == __ ( package_name = self .package_name ,
48+ target_path = str (_ .path ())
49+ local_install_data = _ .install ()
50+ assert type (local_install_data ) is Schema__Lambda__Dependency__Local_Install__Data
51+ assert _ .install__data__exists () is True
52+ assert folder_exists (target_path ) is True
53+
54+ if in_github_action ():
55+ stdout = local_install_data .install_data .get ('stdout' )
56+ else :
57+ stdout = (f'Collecting { LAMBDA_DEPENDENCY__SMALL_TEST__PACKAGE } \n '
58+ ' Using cached '
59+ 'colorama-0.4.6-py2.py3-none-any.whl.metadata (17 '
60+ 'kB)\n '
61+ 'Using cached colorama-0.4.6-py2.py3-none-any.whl '
62+ '(25 kB)\n '
63+ 'Installing collected packages: colorama\n '
64+ 'Successfully installed colorama-0.4.6\n ' )
65+ assert local_install_data .obj () == __ ( package_name = self .package_name ,
5366 target_path = target_path ,
5467 install_data = __ (cwd = '.' ,
5568 error = None ,
@@ -63,15 +76,8 @@ def test__2__install(self):
6376 target_path ,
6477 self .package_name ],
6578 status = 'ok' ,
66- stdout = f'Collecting { LAMBDA_DEPENDENCY__SMALL_TEST__PACKAGE } \n '
67- ' Using cached '
68- 'colorama-0.4.6-py2.py3-none-any.whl.metadata (17 '
69- 'kB)\n '
70- 'Using cached colorama-0.4.6-py2.py3-none-any.whl '
71- '(25 kB)\n '
72- 'Installing collected packages: colorama\n '
73- 'Successfully installed colorama-0.4.6\n ' ,
74- stderr = install_data .install_data .get ('stderr' )),
79+ stdout = stdout ,
80+ stderr = local_install_data .install_data .get ('stderr' )),
7581 installed_files = ['colorama-0.4.6.dist-info/INSTALLER' ,
7682 'colorama-0.4.6.dist-info/METADATA' ,
7783 'colorama-0.4.6.dist-info/RECORD' ,
@@ -104,8 +110,8 @@ def test__2__install(self):
104110 'colorama/tests/winterm_test.py' ,
105111 'colorama/win32.py' ,
106112 'colorama/winterm.py' ],
107- time_stamp = install_data .time_stamp ,
108- duration = install_data .duration )
113+ time_stamp = local_install_data .time_stamp ,
114+ duration = local_install_data .duration )
109115
110116 def test__files__zipped (self ): # as a good example of the performance of zip and locally file access, this test runs in about 13ms
111117 with self .lambda_dependency_local as _ :
0 commit comments