Main entry point for the test runner.
()
| 377 | return '\n'.join(lines) |
| 378 | |
| 379 | def main(): |
| 380 | """Main entry point for the test runner.""" |
| 381 | parser = argparse.ArgumentParser( |
| 382 | description="Advanced Test Runner for PyFlowGraph", |
| 383 | formatter_class=argparse.RawDescriptionHelpFormatter, |
| 384 | epilog=""" |
| 385 | Examples: |
| 386 | python test_runner.py # Run all tests in parallel |
| 387 | python test_runner.py --fast # Run only fast tests (no GUI) |
| 388 | python test_runner.py --gui-only # Run only GUI tests |
| 389 | python test_runner.py --changed # Run tests for changed files |
| 390 | python test_runner.py --coverage # Run with coverage analysis |
| 391 | python test_runner.py --format claude # Claude Code optimized output |
| 392 | """ |
| 393 | ) |
| 394 | |
| 395 | # Test selection options |
| 396 | parser.add_argument("--fast", action="store_true", |
| 397 | help="Run fast tests only (skip GUI and slow tests)") |
| 398 | parser.add_argument("--gui-only", action="store_true", |
| 399 | help="Run GUI tests only") |
| 400 | parser.add_argument("--unit-only", action="store_true", |
| 401 | help="Run unit tests only") |
| 402 | parser.add_argument("--changed", action="store_true", |
| 403 | help="Run tests for changed files only (requires git)") |
| 404 | |
| 405 | # Execution options |
| 406 | parser.add_argument("--no-parallel", action="store_true", |
| 407 | help="Disable parallel execution") |
| 408 | parser.add_argument("--workers", type=int, |
| 409 | help="Number of parallel workers (default: auto)") |
| 410 | parser.add_argument("--coverage", action="store_true", |
| 411 | help="Generate coverage report") |
| 412 | |
| 413 | # Output options |
| 414 | parser.add_argument("--format", choices=["detailed", "summary", "claude"], |
| 415 | default="detailed", help="Output format") |
| 416 | parser.add_argument("--verbose", action="store_true", |
| 417 | help="Verbose output") |
| 418 | parser.add_argument("--output-file", |
| 419 | help="Save report to file") |
| 420 | |
| 421 | args = parser.parse_args() |
| 422 | |
| 423 | # Run tests |
| 424 | runner = TestRunner() |
| 425 | |
| 426 | try: |
| 427 | report = runner.run_tests(args) |
| 428 | |
| 429 | # Format and display results |
| 430 | formatted_report = runner.format_report(report, args.format) |
| 431 | print(formatted_report) |
| 432 | |
| 433 | # Save to file if requested |
| 434 | if args.output_file: |
| 435 | with open(args.output_file, 'w') as f: |
| 436 | f.write(formatted_report) |
no test coverage detected