1313
1414from aws_lambda_builders .builder import LambdaBuilder
1515from aws_lambda_builders .architecture import ARM64 , X86_64
16+ from aws_lambda_builders .supported_runtimes import DOTNET_RUNTIMES
17+
18+
19+ def get_dotnet_test_params ():
20+ """Generate test parameters from DOTNET_RUNTIMES for standard Lambda functions."""
21+ params = []
22+ for runtime in DOTNET_RUNTIMES :
23+ version_num = runtime .replace ("dotnet" , "" )
24+ version = f"{ version_num } .0"
25+ test_project = f"WithDefaultsFile{ version_num } "
26+ params .append ((runtime , version , test_project ))
27+ return params
28+
29+
30+ def get_custom_runtime_test_params ():
31+ """Generate test parameters from DOTNET_RUNTIMES for custom runtime builds.
32+
33+ Note: dotnet6 is excluded as it doesn't support custom runtime in the same way.
34+ """
35+ params = []
36+ for runtime in DOTNET_RUNTIMES :
37+ if runtime == "dotnet6" :
38+ continue
39+ version_num = runtime .replace ("dotnet" , "" )
40+ version = f"{ version_num } .0"
41+ test_project = f"CustomRuntime{ version_num } "
42+ params .append ((runtime , version , test_project ))
43+ return params
1644
1745
1846class TestDotnetBase (TestCase ):
@@ -57,12 +85,7 @@ class TestDotnet(TestDotnetBase):
5785 def setUp (self ):
5886 super (TestDotnet , self ).setUp ()
5987
60- @parameterized .expand (
61- [
62- ("dotnet6" , "6.0" , "WithDefaultsFile6" ),
63- ("dotnet8" , "8.0" , "WithDefaultsFile8" ),
64- ]
65- )
88+ @parameterized .expand (get_dotnet_test_params ())
6689 def test_with_defaults_file (self , runtime , version , test_project ):
6790 source_dir = os .path .join (self .TEST_DATA_FOLDER , test_project )
6891
@@ -83,12 +106,7 @@ def test_with_defaults_file(self, runtime, version, test_project):
83106 self .assertEqual (expected_files , output_files )
84107 self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" , version )
85108
86- @parameterized .expand (
87- [
88- ("dotnet6" , "6.0" , "WithDefaultsFile6" ),
89- ("dotnet8" , "8.0" , "WithDefaultsFile8" ),
90- ]
91- )
109+ @parameterized .expand (get_dotnet_test_params ())
92110 def test_with_defaults_file_x86 (self , runtime , version , test_project ):
93111 source_dir = os .path .join (self .TEST_DATA_FOLDER , test_project )
94112
@@ -109,12 +127,7 @@ def test_with_defaults_file_x86(self, runtime, version, test_project):
109127 self .assertEqual (expected_files , output_files )
110128 self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-x64" , version )
111129
112- @parameterized .expand (
113- [
114- ("dotnet6" , "6.0" , "WithDefaultsFile6" ),
115- ("dotnet8" , "8.0" , "WithDefaultsFile8" ),
116- ]
117- )
130+ @parameterized .expand (get_dotnet_test_params ())
118131 def test_with_defaults_file_arm64 (self , runtime , version , test_project ):
119132 source_dir = os .path .join (self .TEST_DATA_FOLDER , test_project )
120133
@@ -135,12 +148,7 @@ def test_with_defaults_file_arm64(self, runtime, version, test_project):
135148 self .assertEqual (expected_files , output_files )
136149 self .verify_architecture ("WithDefaultsFile.deps.json" , "linux-arm64" , version )
137150
138- @parameterized .expand (
139- [
140- # ("dotnet6", "6.0", "CustomRuntime6"),
141- ("dotnet8" , "8.0" , "CustomRuntime8" ),
142- ]
143- )
151+ @parameterized .expand (get_custom_runtime_test_params ())
144152 def test_with_custom_runtime (self , runtime , version , test_project ):
145153 source_dir = os .path .join (self .TEST_DATA_FOLDER , test_project )
146154
0 commit comments