#!/usr/bin/env python3 """ Test script to verify warning suppression is working. This script imports the same libraries as server.py to test warning behavior. """ import warnings import os # Apply the same warning suppression as server.py warnings.filterwarnings("ignore", category=UserWarning, module="pygame.*") warnings.filterwarnings("ignore", category=FutureWarning, module="torch.*") warnings.filterwarnings("ignore", category=FutureWarning, module="audiotools.*") warnings.filterwarnings("ignore", message=".*pkg_resources is deprecated.*") warnings.filterwarnings("ignore", message=".*torch\\.load.*weights_only.*") warnings.filterwarnings("ignore", message=".*torch\\.nn\\.utils\\.weight_norm.*deprecated.*") # Suppress common ML library warnings warnings.filterwarnings("ignore", category=UserWarning, module="transformers.*") warnings.filterwarnings("ignore", category=UserWarning, module="whisper.*") warnings.filterwarnings("ignore", category=UserWarning, module="librosa.*") print("=== TESTING WARNING SUPPRESSION ===") # Test imports that would normally generate warnings print("1. Testing pygame/librosa import...") try: import librosa print(" ✓ librosa imported without warnings") except Exception as e: print(f" ⚠ librosa import issue: {e}") print("2. Testing torch import...") try: import torch print(" ✓ torch imported without warnings") except Exception as e: print(f" ⚠ torch import issue: {e}") print("3. Testing transformers import...") try: from transformers import AutoTokenizer print(" ✓ transformers imported without warnings") except Exception as e: print(f" ⚠ transformers import issue: {e}") print("4. Testing outetts import...") try: import outetts print(" ✓ outetts imported without warnings") except Exception as e: print(f" ⚠ outetts import issue: {e}") print("\n=== TEST COMPLETE ===") print("If you see this message without the warnings from your original output,") print("then warning suppression is working correctly!") print("=" * 50)