-
Notifications
You must be signed in to change notification settings - Fork 1
fix(CODEWIKI-009): CU-86akbhhru 3 review findings across 3 files #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,48 @@ class Colors: | |
| END = '\033[0m' | ||
|
|
||
|
|
||
| class TestResults: | ||
| """Accumulates test results across the suite and prints a summary.""" | ||
|
|
||
| def __init__(self): | ||
| self.results = {} | ||
|
|
||
| def add_test(self, name: str, passed: bool): | ||
| """Record the result of a single test. | ||
|
|
||
| Args: | ||
| name: Test name | ||
| passed: Whether the test passed | ||
| """ | ||
| self.results[name] = passed | ||
|
|
||
| def print_summary(self) -> int: | ||
| """Print formatted summary of all recorded test results. | ||
|
|
||
| Returns: | ||
| Exit code: 0 if all tests passed, 1 otherwise | ||
| """ | ||
| print_header("Test Results Summary") | ||
|
|
||
| passed = sum(1 for r in self.results.values() if r) | ||
| total = len(self.results) | ||
|
|
||
| for test_name, result in self.results.items(): | ||
| if result: | ||
| print_success(f"{test_name}") | ||
| else: | ||
| print_error(f"{test_name}") | ||
|
|
||
| print(f"\n{Colors.BOLD}Total: {passed}/{total} tests passed{Colors.END}") | ||
|
|
||
| if passed == total: | ||
| print(f"{Colors.GREEN}{Colors.BOLD}β All tests passed!{Colors.END}\n") | ||
| return 0 | ||
| else: | ||
| print(f"{Colors.RED}{Colors.BOLD}β Some tests failed{Colors.END}\n") | ||
| return 1 | ||
|
|
||
|
|
||
| def print_header(text: str): | ||
| """Print formatted test header.""" | ||
| print(f"\n{Colors.BOLD}{Colors.BLUE}{'='*70}{Colors.END}") | ||
|
Comment on lines
42
to
89
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 𦩠π test_multi_path.py defines test_ functions returning bool but never assembles them via a TestResults accumulator* Added a π€ Prompt for AI agentsfix confidence: π‘ 65 medium β react π/π to teach the reviewer |
||
|
|
@@ -485,38 +527,19 @@ def run_all_tests(): | |
| ("Relative vs Absolute Paths", test_relative_vs_absolute_paths), | ||
| ] | ||
|
|
||
| results = {} | ||
| test_results = TestResults() | ||
|
|
||
| for test_name, test_func in tests: | ||
| try: | ||
| result = test_func() | ||
| results[test_name] = result | ||
| test_results.add_test(test_name, result) | ||
| except Exception as e: | ||
| print_error(f"Test '{test_name}' crashed: {str(e)}") | ||
| import traceback | ||
| traceback.print_exc() | ||
| results[test_name] = False | ||
|
|
||
| # Print summary | ||
| print_header("Test Results Summary") | ||
|
|
||
| passed = sum(1 for r in results.values() if r) | ||
| total = len(results) | ||
|
|
||
| for test_name, result in results.items(): | ||
| if result: | ||
| print_success(f"{test_name}") | ||
| else: | ||
| print_error(f"{test_name}") | ||
|
|
||
| print(f"\n{Colors.BOLD}Total: {passed}/{total} tests passed{Colors.END}") | ||
| test_results.add_test(test_name, False) | ||
|
|
||
| if passed == total: | ||
| print(f"{Colors.GREEN}{Colors.BOLD}β All tests passed!{Colors.END}\n") | ||
| return 0 | ||
| else: | ||
| print(f"{Colors.RED}{Colors.BOLD}β Some tests failed{Colors.END}\n") | ||
| return 1 | ||
| return test_results.print_summary() | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
𦩠π integration_test.py uses a custom IntegrationTestRunner/self.results dict pattern instead of the mandated TestResults accumulator with add_test/print_summary
Replaced the raw
self.results = {"passed": [], "failed": [], "warnings": []}dict and private_asserthelper inIntegrationTestRunner.__init__/_assertwith a newTestResultsclass (exposingadd_test(name, passed, details)andprint_summary()) per CODEWIKI-009. All call sites (setup_test_environment,create_config,validate_paths,execute_dependency_parser,verify_namespaces,_verify_namespace_counts,verify_cross_path_dependencies,verify_no_warnings,verify_file_counts) now callself.results.add_test(...)instead ofself._assert(...). The oldprint_validation_summarymethod was removed and its logic folded intoTestResults.print_summary(), whichrun()now calls directly;run()exits non-zero viaself.results.all_passed(), preserving the crash-handling and cleanup behavior. Risk: this is a moderately invasive internal restructuring within one file (no shared/importedTestResultsmodule was available to reuse, so a local class was defined instead) β if other scripts in the repo import a canonicalTestResultsfrom a shared module, this local duplicate may not match its exact API/signature exactly and should ideally be replaced with an import once that shared module's location is confirmed.π€ Prompt for AI agents
fix confidence: π‘ 70 medium β react π/π to teach the reviewer