Run all tests based on command-line arguments.
(args)
| 632 | # ================= MAIN ================= |
| 633 | |
| 634 | async def run_tests(args): |
| 635 | """Run all tests based on command-line arguments.""" |
| 636 | # Track test results |
| 637 | results = {} |
| 638 | |
| 639 | # First run non-streaming tests |
| 640 | if not args.streaming_only: |
| 641 | print("\n\n=========== RUNNING NON-STREAMING TESTS ===========\n") |
| 642 | for test_name, test_data in TEST_SCENARIOS.items(): |
| 643 | # Skip streaming tests |
| 644 | if test_data.get("stream"): |
| 645 | continue |
| 646 | |
| 647 | # Skip tool tests if requested |
| 648 | if args.simple and "tools" in test_data: |
| 649 | continue |
| 650 | |
| 651 | # Skip non-tool tests if tools_only |
| 652 | if args.tools_only and "tools" not in test_data: |
| 653 | continue |
| 654 | |
| 655 | # Run the test |
| 656 | check_tools = "tools" in test_data |
| 657 | result = test_request(test_name, test_data, check_tools=check_tools) |
| 658 | results[test_name] = result |
| 659 | |
| 660 | # Now run streaming tests |
| 661 | if not args.no_streaming: |
| 662 | print("\n\n=========== RUNNING STREAMING TESTS ===========\n") |
| 663 | for test_name, test_data in TEST_SCENARIOS.items(): |
| 664 | # Only select streaming tests, or force streaming |
| 665 | if not test_data.get("stream") and not test_name.endswith("_stream"): |
| 666 | continue |
| 667 | |
| 668 | # Skip tool tests if requested |
| 669 | if args.simple and "tools" in test_data: |
| 670 | continue |
| 671 | |
| 672 | # Skip non-tool tests if tools_only |
| 673 | if args.tools_only and "tools" not in test_data: |
| 674 | continue |
| 675 | |
| 676 | # Run the streaming test |
| 677 | result = await test_streaming(test_name, test_data) |
| 678 | results[f"{test_name}_streaming"] = result |
| 679 | |
| 680 | # Print summary |
| 681 | print("\n\n=========== TEST SUMMARY ===========\n") |
| 682 | total = len(results) |
| 683 | passed = sum(1 for v in results.values() if v) |
| 684 | |
| 685 | for test, result in results.items(): |
| 686 | print(f"{test}: {'✅ PASS' if result else '❌ FAIL'}") |
| 687 | |
| 688 | print(f"\nTotal: {passed}/{total} tests passed") |
| 689 | |
| 690 | if passed == total: |
| 691 | print("\n🎉 All tests passed!") |
no test coverage detected