MCPcopy Create free account
hub / github.com/FastLED/FastLED / FingerprintResult

Class FingerprintResult

ci/util/test_types.py:161–204  ·  view source on GitHub ↗

Type-safe fingerprint result with test metadata for cache display

Source from the content-addressed store, hash-verified

159@typechecked
160@dataclass
161class FingerprintResult:
162 """Type-safe fingerprint result with test metadata for cache display"""
163
164 hash: str
165 elapsed_seconds: Optional[str] = None
166 status: Optional[str] = None
167 # Test result metadata - stored when tests complete for display on cache hits
168 num_tests_run: Optional[int] = None
169 num_tests_passed: Optional[int] = None
170 duration_seconds: Optional[float] = None
171 test_name: Optional[str] = None # Human-readable test category name
172
173 def get_cache_summary(self) -> str:
174 """Get a human-readable summary of cached test results"""
175 if self.num_tests_run is not None and self.num_tests_passed is not None:
176 duration_str = (
177 f" in {self.duration_seconds:.2f}s" if self.duration_seconds else ""
178 )
179 return f"{self.num_tests_passed}/{self.num_tests_run} passed{duration_str}"
180 return ""
181
182 def should_skip(self, current: "FingerprintResult") -> bool:
183 """
184 Determine if we should skip running tests based on fingerprint comparison.
185
186 Args:
187 current: The current fingerprint calculated from the codebase
188
189 Returns:
190 True if we should skip (cache hit), False if we should run tests
191
192 Logic:
193 - Skip if hash matches AND previous status was "success"
194 - Always run if hash differs (code changed)
195 - Always run if previous status was not "success" (previous failure)
196 """
197 if self.hash != current.hash:
198 # Code changed - must run
199 return False
200 if self.status != "success":
201 # Previous run failed - must run again
202 return False
203 # Hash matches and previous run succeeded - safe to skip
204 return True
205
206
207def process_test_flags(args: TestArgs) -> TestArgs:

Callers 7

readMethod · 0.90
_mtime_fast_pathMethod · 0.90
fingerprint_code_baseFunction · 0.85

Calls

no outgoing calls