Files
wehub-resource-sync 97e91a83f3
Ruff / Ruff (push) Waiting to run
Test / Core Tests (push) Waiting to run
Test / Offline Coverage Tests (Python 3.10) (push) Waiting to run
Test / Offline Coverage Tests (Python 3.11) (push) Waiting to run
Test / Offline Coverage Tests (Python 3.12) (push) Waiting to run
Test / Offline Coverage Tests (Python 3.13) (push) Waiting to run
Test / Offline Coverage Tests (Python 3.9) (push) Waiting to run
Test / Full Coverage (Python 3.11) (push) Waiting to run
Test / Core Provider Tests (OpenAI) (push) Blocked by required conditions
Test / Core Provider Tests (Anthropic) (push) Blocked by required conditions
Test / Core Provider Tests (Google) (push) Blocked by required conditions
Test / Core Provider Tests (Other) (push) Blocked by required conditions
Test / Anthropic Tests (push) Blocked by required conditions
Test / Gemini Tests (push) Blocked by required conditions
Test / Google GenAI Tests (push) Blocked by required conditions
Test / Vertex AI Tests (push) Blocked by required conditions
Test / OpenAI Tests (push) Blocked by required conditions
Test / Writer Tests (push) Blocked by required conditions
Test / Auto Client Tests (push) Blocked by required conditions
ty / type-check (push) Waiting to run
chore: import upstream snapshot with attribution
2026-07-13 13:36:38 +08:00

55 lines
1.6 KiB
Python
Executable File

#!/usr/bin/env python3
"""Fix doc test formatting issues using --update-examples for each test file."""
import subprocess
import sys
from pathlib import Path
test_files = [
"tests/docs/test_concepts_operations.py",
"tests/docs/test_examples_batch.py",
"tests/docs/test_examples_integrations.py",
"tests/docs/test_examples_multimodal.py",
"tests/docs/test_posts.py",
]
def run_update(test_file: str) -> bool:
"""Run --update-examples on a test file."""
print(f"\n{'=' * 60}")
print(f"Processing: {test_file}")
print(f"{'=' * 60}")
cmd = ["uv", "run", "pytest", test_file, "--update-examples", "-q", "--tb=no"]
try:
result = subprocess.run(
cmd, capture_output=True, text=True, cwd=Path(__file__).parent.parent
)
if result.returncode == 0:
print(f"✓ Successfully updated {test_file}")
return True
else:
# Even with errors, some files might have been updated
print(f"⚠ Completed {test_file} with exit code {result.returncode}")
if result.stdout:
print("STDOUT:", result.stdout[-500:]) # Last 500 chars
return False
except Exception as e:
print(f"✗ Error processing {test_file}: {e}")
return False
if __name__ == "__main__":
success_count = 0
for test_file in test_files:
if run_update(test_file):
success_count += 1
print(f"\n{'=' * 60}")
print(f"Summary: {success_count}/{len(test_files)} files processed")
print(f"{'=' * 60}")
sys.exit(0 if success_count == len(test_files) else 1)