| 84 | return self.fingerprint_dir / f"{name}.json" |
| 85 | |
| 86 | def read(self, name: str) -> Optional[FingerprintResult]: |
| 87 | fingerprint_file = self._get_fingerprint_file(name) |
| 88 | if fingerprint_file.exists(): |
| 89 | with open(fingerprint_file, "r") as f: |
| 90 | try: |
| 91 | data = json.load(f) |
| 92 | return FingerprintResult( |
| 93 | hash=data.get("hash", ""), |
| 94 | elapsed_seconds=data.get("elapsed_seconds"), |
| 95 | status=data.get("status"), |
| 96 | num_tests_run=data.get("num_tests_run"), |
| 97 | num_tests_passed=data.get("num_tests_passed"), |
| 98 | duration_seconds=data.get("duration_seconds"), |
| 99 | test_name=data.get("test_name"), |
| 100 | ) |
| 101 | except json.JSONDecodeError: |
| 102 | ts_print(f"Invalid {name} fingerprint file. Recalculating...") |
| 103 | return None |
| 104 | |
| 105 | def write(self, name: str, fingerprint: FingerprintResult) -> None: |
| 106 | fingerprint_file = self._get_fingerprint_file(name) |