test_no_timeout.py 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/usr/bin/env python3
  2. """
  3. Test script to verify that USM autoprovides command no longer has a timeout.
  4. """
  5. import sys
  6. import time
  7. from pathlib import Path
  8. # Add the src directory to the path so we can import autusm
  9. sys.path.insert(0, str(Path(__file__).parent / "src"))
  10. from autusm.usm_integration import USMIntegration
  11. def test_no_timeout():
  12. """Test that autoprovides can run without timeout."""
  13. print("Testing USM autoprovides without timeout...")
  14. # Initialize USM integration
  15. usm = USMIntegration()
  16. # Check if USM is available
  17. if not usm.is_available():
  18. print("USM is not available on this system. Skipping test.")
  19. return True
  20. print("USM is available. Testing autoprovides without timeout...")
  21. # Try to get autoprovides for the current directory
  22. # This will test if the timeout has been removed
  23. try:
  24. start_time = time.time()
  25. autoprovides = usm.get_autoprovides(Path.cwd())
  26. end_time = time.time()
  27. elapsed_time = end_time - start_time
  28. print(f"Autoprovides completed in {elapsed_time:.2f} seconds")
  29. print(f"Found {len(autoprovides)} autoprovides")
  30. # If we get here without a timeout error, the test passes
  31. print("SUCCESS: No timeout occurred!")
  32. return True
  33. except Exception as e:
  34. print(f"ERROR: {e}")
  35. return False
  36. if __name__ == "__main__":
  37. success = test_no_timeout()
  38. sys.exit(0 if success else 1)