#!/usr/bin/env python3 """ Simple test script that works in any environment. """ import subprocess import sys from pathlib import Path # Add the project root to Python path so we can import mini_rag project_root = Path(__file__).parent.parent sys.path.insert(0, str(project_root)) def main(): """Test basic functionality without installing.""" print("๐Ÿงช FSS-Mini-RAG Simple Tests") print("=" * 40) # Test CLI import print("1. Testing CLI import...") try: import mini_rag.cli print(" โœ… CLI module imports successfully") except ImportError as e: print(f" โŒ CLI import failed: {e}") return 1 # Test console script entry point print("2. Testing entry point...") try: from mini_rag.cli import cli print(" โœ… Entry point function accessible") except ImportError as e: print(f" โŒ Entry point not accessible: {e}") return 1 # Test help command (should work without dependencies) print("3. Testing help command...") try: # This will test the CLI without actually running commands that need dependencies result = subprocess.run([ sys.executable, "-c", "from mini_rag.cli import cli; import sys; sys.argv = ['rag-mini', '--help']; cli()" ], capture_output=True, text=True, timeout=10) if result.returncode == 0 and "Mini RAG" in result.stdout: print(" โœ… Help command works") else: print(f" โŒ Help command failed: {result.stderr}") return 1 except Exception as e: print(f" โŒ Help command test failed: {e}") return 1 # Test install scripts exist print("4. Testing install scripts...") if Path("install.sh").exists(): print(" โœ… install.sh exists") else: print(" โŒ install.sh missing") return 1 if Path("install.ps1").exists(): print(" โœ… install.ps1 exists") else: print(" โŒ install.ps1 missing") return 1 # Test pyproject.toml has correct entry point print("5. Testing pyproject.toml...") try: with open("pyproject.toml") as f: content = f.read() if 'rag-mini = "mini_rag.cli:cli"' in content: print(" โœ… Entry point correctly configured") else: print(" โŒ Entry point not found in pyproject.toml") return 1 if 'name = "fss-mini-rag"' in content: print(" โœ… Package name correctly set") else: print(" โŒ Package name not set correctly") return 1 except Exception as e: print(f" โŒ pyproject.toml test failed: {e}") return 1 print("\n๐ŸŽ‰ All basic tests passed!") print("\n๐Ÿ“‹ To complete setup:") print(" 1. Commit and push these changes") print(" 2. Create a GitHub release to trigger wheel building") print(" 3. Test installation methods:") print(" โ€ข curl -fsSL https://raw.githubusercontent.com/fsscoding/fss-mini-rag/main/install.sh | bash") print(" โ€ข pipx install fss-mini-rag") print(" โ€ข uv tool install fss-mini-rag") return 0 if __name__ == "__main__": sys.exit(main())