#!/usr/bin/env python3 """ Test script to verify uvx functionality. """ import subprocess import sys import os def test_uvx(): """Test that uvx can run the application.""" print("๐Ÿงช Testing uvx functionality...") # Set test environment variables env = os.environ.copy() env['PORTAINER_URL'] = 'https://demo.portainer.io' env['PORTAINER_API_KEY'] = 'demo-key' try: # Test uvx --help first result = subprocess.run([ 'uvx', '--help' ], capture_output=True, text=True, timeout=10) if result.returncode != 0: print("โŒ uvx not available") return False print("โœ… uvx is available") # Test that our package can be found print("๐Ÿ“ฆ Testing package discovery...") result = subprocess.run([ 'uvx', '--from', '.', 'portainer-core-mcp', '--help' ], capture_output=True, text=True, timeout=10, env=env) if result.returncode != 0: print(f"โŒ Package test failed: {result.stderr}") return False print("โœ… Package can be discovered by uvx") return True except subprocess.TimeoutExpired: print("โŒ uvx test timed out") return False except FileNotFoundError: print("โŒ uvx not found - install with: pip install uv") return False except Exception as e: print(f"โŒ uvx test failed: {e}") return False if __name__ == "__main__": success = test_uvx() sys.exit(0 if success else 1)