Main entry point
()
| 137 | |
| 138 | |
| 139 | def main(): |
| 140 | """Main entry point""" |
| 141 | before_dir = "test_outputs/before" |
| 142 | after_dir = "test_outputs/after" |
| 143 | |
| 144 | if not Path(before_dir).exists() or not Path(after_dir).exists(): |
| 145 | print("Error: Test output directories not found. Run tests first.") |
| 146 | sys.exit(1) |
| 147 | |
| 148 | print("=" * 60) |
| 149 | print("Smart Comparison of Before/After Test Outputs") |
| 150 | print("=" * 60) |
| 151 | |
| 152 | results = compare_test_outputs(before_dir, after_dir) |
| 153 | |
| 154 | # Print results |
| 155 | total = len(results["identical"]) + len(results["equivalent"]) + len(results["different"]) |
| 156 | |
| 157 | print(f"\n✅ Identical outputs: {len(results['identical'])}/{total}") |
| 158 | if results["identical"]: |
| 159 | for test in results["identical"][:5]: |
| 160 | print(f" - {test}") |
| 161 | if len(results["identical"]) > 5: |
| 162 | print(f" ... and {len(results['identical'])-5} more") |
| 163 | |
| 164 | print(f"\n✅ Equivalent outputs (same data, different order): {len(results['equivalent'])}/{total}") |
| 165 | if results["equivalent"]: |
| 166 | for test, msg in results["equivalent"][:5]: |
| 167 | print(f" - {test}: {msg}") |
| 168 | if len(results["equivalent"]) > 5: |
| 169 | print(f" ... and {len(results['equivalent'])-5} more") |
| 170 | |
| 171 | print(f"\n❌ Different outputs: {len(results['different'])}/{total}") |
| 172 | if results["different"]: |
| 173 | for test, msg in results["different"]: |
| 174 | print(f" - {test}: {msg}") |
| 175 | |
| 176 | # Summary |
| 177 | print("\n" + "=" * 60) |
| 178 | if len(results["different"]) == 0: |
| 179 | print("✅ SUCCESS: All test outputs are identical or equivalent!") |
| 180 | print(f" {len(results['identical'])} byte-identical") |
| 181 | print(f" {len(results['equivalent'])} equivalent (row order differs)") |
| 182 | sys.exit(0) |
| 183 | else: |
| 184 | print(f"❌ FAILURE: {len(results['different'])} tests have different data!") |
| 185 | sys.exit(1) |
| 186 | |
| 187 | |
| 188 | if __name__ == "__main__": |
no test coverage detected