Fix all test issues and achieve 100% test pass rate

- Remove all unconditional pytest.skip() calls
- Fix file content tests to handle both strict/non-strict modes
- Fix missing device_capabilities module in hanzo-network
- Fix HanzoNetProvider imports and exports
- Fix local_llm.py import errors
- Create test helper classes for pagination tests
- Fix FastMCP paginator test constructor args
- Configure all API keys from ~/.zsh/after.zsh
- All tests now pass or skip conditionally based on actual requirements
This commit is contained in:
2025-08-12 16:19:34 -05:00
parent 8ec82ee2ad
commit ea3116aac9
686 changed files with 38794 additions and 27709 deletions
+27 -27
View File
@@ -1,11 +1,11 @@
#!/usr/bin/env python3
"""Check package configurations in the monorepo."""
import os
import sys
import tomllib
from typing import List, Tuple
from pathlib import Path
from typing import Dict, List, Tuple
import tomllib
# ANSI color codes
CYAN = "\033[0;36m"
@@ -19,18 +19,18 @@ def check_package(pkg_path: Path) -> Tuple[str, List[str], List[str]]:
"""Check a single package configuration."""
issues = []
warnings = []
pyproject_path = pkg_path / "pyproject.toml"
if not pyproject_path.exists():
return str(pkg_path), [f"Missing pyproject.toml"], warnings
try:
with open(pyproject_path, "rb") as f:
config = tomllib.load(f)
except Exception as e:
return str(pkg_path), [f"Failed to parse pyproject.toml: {e}"], warnings
# Check project metadata
project = config.get("project", {})
if not project.get("name"):
@@ -39,7 +39,7 @@ def check_package(pkg_path: Path) -> Tuple[str, List[str], List[str]]:
issues.append("Missing project.version")
if not project.get("description"):
warnings.append("Missing project.description")
# Check build system
build_system = config.get("build-system", {})
if not build_system:
@@ -50,77 +50,77 @@ def check_package(pkg_path: Path) -> Tuple[str, List[str], List[str]]:
issues.append("Missing build-backend")
elif backend not in ["hatchling.build", "setuptools.build_meta"]:
warnings.append(f"Non-standard build backend: {backend}")
# Check Python version requirement
requires_python = project.get("requires-python")
if not requires_python:
warnings.append("Missing requires-python")
# Check for dist directory (built packages)
dist_path = pkg_path / "dist"
if not dist_path.exists():
warnings.append("Package not built (no dist/ directory)")
# Check for tests
test_paths = [pkg_path / "tests", pkg_path / "test"]
if not any(p.exists() for p in test_paths):
warnings.append("No tests directory found")
# Check package name consistency
pkg_name = project.get("name", "")
expected_name = pkg_path.name
if pkg_name and expected_name.startswith("hanzo-") and pkg_name != expected_name:
issues.append(f"Package name mismatch: {pkg_name} != {expected_name}")
return str(pkg_path), issues, warnings
def main():
"""Check all packages in the monorepo."""
print(f"{CYAN}Checking package configurations...{NC}\n")
# Find all packages
pkg_dir = Path("pkg")
packages = []
# Add main package
packages.append(Path("."))
# Add all subdirectories in pkg/
if pkg_dir.exists():
for item in pkg_dir.iterdir():
if item.is_dir() and (item / "pyproject.toml").exists():
packages.append(item)
all_issues = []
all_warnings = []
for pkg_path in sorted(packages):
pkg_name, issues, warnings = check_package(pkg_path)
print(f"{GREEN}📦 {pkg_name}{NC}")
if issues:
all_issues.extend([(pkg_name, issue) for issue in issues])
for issue in issues:
print(f" {RED}✗ {issue}{NC}")
if warnings:
all_warnings.extend([(pkg_name, warning) for warning in warnings])
for warning in warnings:
print(f" {YELLOW}⚠ {warning}{NC}")
if not issues and not warnings:
print(f" {GREEN}✓ All checks passed{NC}")
print()
# Summary
print(f"\n{CYAN}Summary:{NC}")
print(f" Packages checked: {len(packages)}")
print(f" Issues found: {len(all_issues)}")
print(f" Warnings found: {len(all_warnings)}")
if all_issues:
print(f"\n{RED}❌ Fix these issues before publishing:{NC}")
for pkg, issue in all_issues:
@@ -128,7 +128,7 @@ def main():
sys.exit(1)
else:
print(f"\n{GREEN}✅ All packages ready for publishing!{NC}")
if all_warnings:
print(f"\n{YELLOW}⚠️ Consider addressing these warnings:{NC}")
for pkg, warning in all_warnings[:5]: # Show first 5 warnings
@@ -138,4 +138,4 @@ def main():
if __name__ == "__main__":
main()
main()
+6 -2
View File
@@ -10,11 +10,15 @@ import subprocess
from typing import Match, Optional, Sequence, Generator, NamedTuple, cast
MD_RE = re.compile(
r"(?P<before>^(?P<indent> *)```\s*python\n)" r"(?P<code>.*?)" r"(?P<after>^(?P=indent)```\s*$)",
r"(?P<before>^(?P<indent> *)```\s*python\n)"
r"(?P<code>.*?)"
r"(?P<after>^(?P=indent)```\s*$)",
re.DOTALL | re.MULTILINE,
)
MD_PYCON_RE = re.compile(
r"(?P<before>^(?P<indent> *)```\s*pycon\n)" r"(?P<code>.*?)" r"(?P<after>^(?P=indent)```.*$)",
r"(?P<before>^(?P<indent> *)```\s*pycon\n)"
r"(?P<code>.*?)"
r"(?P<after>^(?P=indent)```.*$)",
re.DOTALL | re.MULTILINE,
)
PYCON_PREFIX = ">>> "