@@ -26,16 +26,16 @@ def test_validate_with_unsupported_runtime(self):
2626 "python3.7" , # Older Python version
2727 "nodejs12.x" , # Legacy Node.js
2828 "nodejs14.x" , # Legacy Node.js
29- "ruby2.7" , # Legacy Ruby
30- "java7" , # Legacy Java
31- "dotnet3.1" , # Legacy .NET
29+ "ruby2.7" , # Legacy Ruby
30+ "java7" , # Legacy Java
31+ "dotnet3.1" , # Legacy .NET
3232 "dotnetcore3.1" , # Legacy .NET Core
33- "go1.19" , # Specific Go version (not go1.x)
34- "php8.1" , # Unsupported language
35- "rust1.0" , # Unsupported language
36- "" , # Empty string
33+ "go1.19" , # Specific Go version (not go1.x)
34+ "php8.1" , # Unsupported language
35+ "rust1.0" , # Unsupported language
36+ "" , # Empty string
3737 ]
38-
38+
3939 for runtime in unsupported_runtimes :
4040 with self .subTest (runtime = runtime ):
4141 validator = RuntimeValidator (runtime = runtime , architecture = X86_64 )
@@ -49,22 +49,22 @@ def test_validate_with_runtime_and_incompatible_architecture(self):
4949 # Test with various invalid architectures
5050 invalid_architectures = [
5151 "invalid_arch" ,
52- "i386" , # 32-bit architecture
53- "armv7" , # 32-bit ARM
54- "mips" , # Different architecture
55- "s390x" , # IBM architecture
56- "ppc64le" , # PowerPC
57- "aarch32" , # 32-bit ARM variant
58- "x86" , # 32-bit x86
59- "arm32" , # 32-bit ARM
60- "" , # Empty string
61- "ARM64" , # Wrong case (should be lowercase)
62- "X86_64" , # Wrong case (should be lowercase)
52+ "i386" , # 32-bit architecture
53+ "armv7" , # 32-bit ARM
54+ "mips" , # Different architecture
55+ "s390x" , # IBM architecture
56+ "ppc64le" , # PowerPC
57+ "aarch32" , # 32-bit ARM variant
58+ "x86" , # 32-bit x86
59+ "arm32" , # 32-bit ARM
60+ "" , # Empty string
61+ "ARM64" , # Wrong case (should be lowercase)
62+ "X86_64" , # Wrong case (should be lowercase)
6363 ]
64-
64+
6565 # Test with a few different supported runtimes
6666 test_runtimes = ["python3.12" , "nodejs20.x" , "java17" , "provided" ]
67-
67+
6868 for runtime in test_runtimes :
6969 for arch in invalid_architectures :
7070 with self .subTest (runtime = runtime , architecture = arch ):
@@ -94,14 +94,14 @@ def test_validate_with_case_sensitive_runtime(self):
9494 ("Provided" , "provided" ),
9595 ("PROVIDED" , "provided" ),
9696 ]
97-
97+
9898 for invalid_case , valid_runtime in case_variants :
9999 with self .subTest (invalid_case = invalid_case , valid_runtime = valid_runtime ):
100100 # Invalid case should fail
101101 validator = RuntimeValidator (runtime = invalid_case , architecture = X86_64 )
102102 with self .assertRaises (UnsupportedRuntimeError ):
103103 validator .validate (f"/usr/bin/{ invalid_case } " )
104-
104+
105105 # Valid case should succeed
106106 validator = RuntimeValidator (runtime = valid_runtime , architecture = X86_64 )
107107 result = validator .validate (f"/usr/bin/{ valid_runtime } " )
@@ -110,15 +110,15 @@ def test_validate_with_case_sensitive_runtime(self):
110110 def test_validate_with_case_sensitive_architecture (self ):
111111 """Test that architecture names are case-sensitive"""
112112 runtime = "python3.12"
113-
113+
114114 # Test invalid case variations (correct values are "arm64" and "x86_64")
115115 invalid_arch_cases = ["ARM64" , "Arm64" , "aRM64" , "X86_64" , "X86-64" , "ARM-64" ]
116116 for arch in invalid_arch_cases :
117117 with self .subTest (architecture = arch ):
118118 validator = RuntimeValidator (runtime = runtime , architecture = arch )
119119 with self .assertRaises (UnsupportedArchitectureError ):
120120 validator .validate ("/usr/bin/python3.12" )
121-
121+
122122 # Test that correct case works
123123 for arch in [ARM64 , X86_64 ]: # These are "arm64" and "x86_64"
124124 validator = RuntimeValidator (runtime = runtime , architecture = arch )
@@ -128,21 +128,21 @@ def test_validate_with_case_sensitive_architecture(self):
128128 def test_validate_edge_case_runtime_names (self ):
129129 """Test validation with edge case runtime names"""
130130 edge_case_runtimes = [
131- "python3.12.1" , # Version with patch number
132- "nodejs20.x.1" , # Version with extra suffix
133- "java17-lts" , # Version with suffix
134- "python3.12-dev" , # Development version
135- "nodejs20" , # Missing .x suffix
136- "python3" , # Missing minor version
137- "java" , # Missing version number
138- "ruby" , # Missing version number
139- "go" , # Missing version
140- "dotnet" , # Missing version
141- "python3.15" , # Future version (not in SUPPORTED_RUNTIMES)
142- "nodejs24.x" , # Future version
143- "java26" , # Future version
131+ "python3.12.1" , # Version with patch number
132+ "nodejs20.x.1" , # Version with extra suffix
133+ "java17-lts" , # Version with suffix
134+ "python3.12-dev" , # Development version
135+ "nodejs20" , # Missing .x suffix
136+ "python3" , # Missing minor version
137+ "java" , # Missing version number
138+ "ruby" , # Missing version number
139+ "go" , # Missing version
140+ "dotnet" , # Missing version
141+ "python3.15" , # Future version (not in SUPPORTED_RUNTIMES)
142+ "nodejs24.x" , # Future version
143+ "java26" , # Future version
144144 ]
145-
145+
146146 for runtime in edge_case_runtimes :
147147 with self .subTest (runtime = runtime ):
148148 validator = RuntimeValidator (runtime = runtime , architecture = X86_64 )
@@ -156,28 +156,26 @@ def test_exception_messages_contain_runtime_info(self):
156156 validator = RuntimeValidator (runtime = runtime , architecture = X86_64 )
157157 with self .assertRaises (UnsupportedRuntimeError ) as context :
158158 validator .validate ("/usr/bin/unsupported" )
159-
159+
160160 error_msg = str (context .exception )
161161 self .assertIn (runtime , error_msg )
162162 self .assertIn ("not supported" , error_msg .lower ())
163-
163+
164164 # Test UnsupportedArchitectureError message
165165 runtime = "python3.12"
166166 arch = "unsupported_arch"
167167 validator = RuntimeValidator (runtime = runtime , architecture = arch )
168168 with self .assertRaises (UnsupportedArchitectureError ) as context :
169169 validator .validate ("/usr/bin/python3.12" )
170-
170+
171171 error_msg = str (context .exception )
172172 self .assertIn (runtime , error_msg )
173173 self .assertIn (arch , error_msg )
174174 self .assertIn ("not supported" , error_msg .lower ())
175175
176176 def test_all_nodejs_runtimes_supported (self ):
177177 """Test all Node.js runtimes are supported with both architectures"""
178- nodejs_runtimes = [
179- "nodejs16.x" , "nodejs18.x" , "nodejs20.x" , "nodejs22.x"
180- ]
178+ nodejs_runtimes = ["nodejs16.x" , "nodejs18.x" , "nodejs20.x" , "nodejs22.x" ]
181179 for runtime in nodejs_runtimes :
182180 for arch in [ARM64 , X86_64 ]:
183181 validator = RuntimeValidator (runtime = runtime , architecture = arch )
@@ -188,8 +186,13 @@ def test_all_nodejs_runtimes_supported(self):
188186 def test_all_python_runtimes_supported (self ):
189187 """Test all Python runtimes are supported with both architectures"""
190188 python_runtimes = [
191- "python3.8" , "python3.9" , "python3.10" , "python3.11" ,
192- "python3.12" , "python3.13" , "python3.14"
189+ "python3.8" ,
190+ "python3.9" ,
191+ "python3.10" ,
192+ "python3.11" ,
193+ "python3.12" ,
194+ "python3.13" ,
195+ "python3.14" ,
193196 ]
194197 for runtime in python_runtimes :
195198 for arch in [ARM64 , X86_64 ]:
@@ -250,22 +253,37 @@ def test_supported_runtimes_constant_completeness(self):
250253 """Test that SUPPORTED_RUNTIMES constant includes all expected runtimes"""
251254 expected_runtimes = {
252255 # Node.js runtimes
253- "nodejs16.x" , "nodejs18.x" , "nodejs20.x" , "nodejs22.x" ,
256+ "nodejs16.x" ,
257+ "nodejs18.x" ,
258+ "nodejs20.x" ,
259+ "nodejs22.x" ,
254260 # Python runtimes
255- "python3.8" , "python3.9" , "python3.10" , "python3.11" ,
256- "python3.12" , "python3.13" , "python3.14" ,
261+ "python3.8" ,
262+ "python3.9" ,
263+ "python3.10" ,
264+ "python3.11" ,
265+ "python3.12" ,
266+ "python3.13" ,
267+ "python3.14" ,
257268 # Ruby runtimes
258- "ruby3.2" , "ruby3.3" , "ruby3.4" ,
269+ "ruby3.2" ,
270+ "ruby3.3" ,
271+ "ruby3.4" ,
259272 # Java runtimes
260- "java8" , "java11" , "java17" , "java21" , "java25" ,
273+ "java8" ,
274+ "java11" ,
275+ "java17" ,
276+ "java21" ,
277+ "java25" ,
261278 # Go runtime
262279 "go1.x" ,
263280 # .NET runtimes
264- "dotnet6" , "dotnet8" ,
281+ "dotnet6" ,
282+ "dotnet8" ,
265283 # Provided runtime
266- "provided"
284+ "provided" ,
267285 }
268-
286+
269287 actual_runtimes = set (SUPPORTED_RUNTIMES .keys ())
270288 self .assertEqual (actual_runtimes , expected_runtimes )
271289
@@ -282,11 +300,11 @@ def test_validate_returns_original_path(self):
282300 ("python3.11" , "/usr/local/bin/python3.11" ),
283301 ("nodejs20.x" , "/opt/node/bin/node" ),
284302 ("java17" , "/usr/lib/jvm/java-17/bin/java" ),
285- ("provided" , "/var/runtime/bootstrap" )
303+ ("provided" , "/var/runtime/bootstrap" ),
286304 ]
287-
305+
288306 for runtime , path in test_cases :
289307 validator = RuntimeValidator (runtime = runtime , architecture = X86_64 )
290308 result = validator .validate (path )
291309 self .assertEqual (result , path )
292- self .assertEqual (validator ._runtime_path , path )
310+ self .assertEqual (validator ._runtime_path , path )
0 commit comments