Run tests directly with F5 debugging support. This function provides a debug-friendly way to run specific tests or all tests with detailed output for troubleshooting.
()
| 1532 | |
| 1533 | |
| 1534 | def main(): |
| 1535 | """ |
| 1536 | Run tests directly with F5 debugging support. |
| 1537 | |
| 1538 | This function provides a debug-friendly way to run specific tests |
| 1539 | or all tests with detailed output for troubleshooting. |
| 1540 | """ |
| 1541 | # Setup UTF-8 output for Windows emoji compatibility |
| 1542 | _setup_utf8_output() |
| 1543 | |
| 1544 | # debug_print("🧪 PlatformIO URL Resolution Tests - Design Implementation") |
| 1545 | print("=" * 65) |
| 1546 | print("Debug Mode: Detailed output enabled for F5 debugging") |
| 1547 | print() |
| 1548 | |
| 1549 | # ========================================================================= |
| 1550 | # TEST EXECUTION OPTIONS - Uncomment one of these modes for focused debugging: |
| 1551 | # ========================================================================= |
| 1552 | |
| 1553 | # Option 1: Run just the new MOCK-FREE tests (recommended for debugging) |
| 1554 | focused_tests = [ |
| 1555 | "test_url_vs_shorthand_detection", # NO MOCKS - real URL detection |
| 1556 | "test_basic_platform_shorthand_resolution", # REAL PlatformIO CLI calls |
| 1557 | "test_url_passthrough_behavior", # NO MOCKS - direct passthrough |
| 1558 | "test_resolution_caching_works", # REAL CLI + caching verification |
| 1559 | # 'test_cache_expiration_behavior', # TODO: Convert to mock-free |
| 1560 | # 'test_failed_resolution_handling' # TODO: Convert to mock-free |
| 1561 | ] |
| 1562 | |
| 1563 | # Option 2: Run a single specific test for deep debugging |
| 1564 | # specific_test = 'test_basic_platform_shorthand_resolution' |
| 1565 | # suite = unittest.TestLoader().loadTestsFromName(specific_test, TestPlatformIOUrlResolution) |
| 1566 | |
| 1567 | # Option 3: Run all tests (default) |
| 1568 | # suite = unittest.TestLoader().loadTestsFromTestCase(TestPlatformIOUrlResolution) |
| 1569 | |
| 1570 | # ACTIVE CONFIGURATION: Run focused simplified tests |
| 1571 | # debug_print("🎯 Running FOCUSED SIMPLIFIED TESTS (Design Implementation)") |
| 1572 | # debug_print(f" Selected tests: {len(focused_tests)}") |
| 1573 | for test_name in focused_tests: |
| 1574 | # debug_print(f" • {test_name}") |
| 1575 | pass |
| 1576 | print() |
| 1577 | |
| 1578 | suite = unittest.TestSuite() |
| 1579 | for test_name in focused_tests: |
| 1580 | try: |
| 1581 | suite.addTest(TestPlatformIOUrlResolution(test_name)) |
| 1582 | except KeyboardInterrupt as ki: |
| 1583 | handle_keyboard_interrupt(ki) |
| 1584 | raise |
| 1585 | except Exception: |
| 1586 | # debug_print(f"⚠️ Could not load test '{test_name}': {e}") |
| 1587 | pass |
| 1588 | |
| 1589 | runner = unittest.TextTestRunner(verbosity=2, stream=sys.stdout, buffer=False) |
| 1590 | |
| 1591 | # debug_print("🚀 Starting focused test execution...") |
no test coverage detected