/
Watashicuvu
/
agentic-tools
Обзор
Документация
Войти
/
Watashicuvu
/
agentic-tools
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
CI/CD
Аналитика
Безопасность
master
src/tests/test_workflow.py
87 строк
3 KB
Якуб
cli fixes
14 апр 2026, 18:32
14 апр 2026, 18:32
6202d02
Код
Авторство
О чём код?
#!/usr/bin/env python3 """Test docstring workflow scripts.""" import logging import subprocess import sys from pathlib import Path def run_command(cmd: list, description: str) -> bool: """Run command and return success status.""" logging.debug(f"\n{'='*60}") logging.debug(f"🧪 {description}") logging.debug(f"{'='*60}") result = subprocess.run(cmd, capture_output=True, text=True) logging.debug(result.stdout) if result.stderr: logging.debug("STDERR:", result.stderr) success = result.returncode == 0 logging.debug(f"{'✅ PASS' if success else '❌ FAIL'}: {cmd[0]}") return success def main(): repo_root = Path.cwd() checklists_dir = repo_root / ".codecontext" / "checklists" logging.debug("🚀 Testing Docstring Workflow Scripts") logging.debug(f"Repository: {repo_root}") tests_passed = 0 tests_total = 0 # Test 1: Generate checklist tests_total += 1 if run_command( [str(checklists_dir / "generate_docstring_checklist.sh"), "--force"], "Step 1: Generate docstring checklist" ): tests_passed += 1 # Test 2: Check files exist tests_total += 1 todo_file = checklists_dir / "docstring_todo.json" status_file = checklists_dir / "docstring.status" if todo_file.exists() and status_file.exists(): logging.debug(f"\n✅ Checklist files exist:") logging.debug(f" - {todo_file}") logging.debug(f" - {status_file}") tests_passed += 1 else: logging.debug(f"\n❌ Checklist files not found!") # Test 3: Validate (should fail initially) tests_total += 1 logging.debug("\n📝 Note: Validation is expected to fail (functions not documented yet)") result = subprocess.run( [str(checklists_dir / "validate_docstrings.sh")], capture_output=True, text=True ) # Ожидаем failure (функции ещё не задокументированы) if result.returncode == 1: logging.debug(f"\n✅ PASS: Validation correctly detected missing docstrings") tests_passed += 1 else: logging.debug(f"\n❌ FAIL: Validation should have failed (functions not documented)") # Summary logging.debug(f"\n{'='*60}") logging.debug(f"📊 Test Summary: {tests_passed}/{tests_total} tests passed") logging.debug(f"{'='*60}") if tests_passed == tests_total: logging.debug("✅ All tests passed!") return 0 else: logging.debug(f"⚠️ {tests_total - tests_passed} tests failed") return 1 if __name__ == "__main__": sys.exit(main())