-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_usage.py
More file actions
87 lines (69 loc) · 2.5 KB
/
Copy pathexample_usage.py
File metadata and controls
87 lines (69 loc) · 2.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env python3
"""
Przykład użycia README Docker Tester programmatycznie
"""
from readme_tester.tester import ReadmeTester
from pathlib import Path
def main():
# Konfiguracja testera
tester = ReadmeTester(
work_dir="./my_tests",
python_version="3.10",
timeout=600, # 10 minut
cleanup=True,
verbose=True
)
# Lista projektów do testowania
test_projects = [
"https://github.com/psf/requests",
"https://github.com/pallets/flask",
"https://github.com/django/django"
]
all_results = []
for github_url in test_projects:
print(f"\n🧪 Testowanie: {github_url}")
try:
# Pobierz projekt
project_path = tester.clone_project(github_url)
# Przeanalizuj README
commands = tester.parse_readme(project_path)
print(f"📝 Znaleziono {len(commands)} komend")
# Zbuduj obraz Docker
tester.build_docker_image(project_path)
# Wykonaj testy
results = tester.run_tests(project_path, commands)
all_results.append({
'project': github_url,
'results': results
})
# Wyświetl wyniki
tester.display_results(results)
except Exception as e:
print(f"❌ Błąd testowania {github_url}: {e}")
all_results.append({
'project': github_url,
'error': str(e)
})
finally:
# Wyczyść po każdym projekcie
tester.cleanup()
# Podsumowanie wszystkich projektów
print("\n" + "="*80)
print("📊 PODSUMOWANIE WSZYSTKICH PROJEKTÓW")
print("="*80)
total_success = 0
total_failed = 0
for result in all_results:
if 'error' in result:
print(f"❌ {result['project']}: BŁĄD - {result['error']}")
total_failed += 1
else:
success = len(result['results']['successful_commands'])
failed = len(result['results']['failed_commands'])
total_success += success
total_failed += failed
status = "✅" if failed == 0 else "⚠️"
print(f"{status} {result['project']}: {success} OK, {failed} błędów")
print(f"\n🎯 OGÓŁEM: {total_success} pomyślnych, {total_failed} błędów")
if __name__ == "__main__":
main()