rosetta-sql 1.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- benchmark/generate_csv_data.py +83 -0
- benchmark/import_data.py +168 -0
- rosetta/__init__.py +3 -0
- rosetta/__main__.py +8 -0
- rosetta/benchmark.py +1678 -0
- rosetta/buglist.py +108 -0
- rosetta/cli/__init__.py +11 -0
- rosetta/cli/config_cmd.py +243 -0
- rosetta/cli/exec.py +219 -0
- rosetta/cli/interactive_cmd.py +124 -0
- rosetta/cli/list_cmd.py +215 -0
- rosetta/cli/main.py +617 -0
- rosetta/cli/output.py +545 -0
- rosetta/cli/result.py +61 -0
- rosetta/cli/result_cmd.py +247 -0
- rosetta/cli/run.py +625 -0
- rosetta/cli/status.py +161 -0
- rosetta/comparator.py +205 -0
- rosetta/config.py +139 -0
- rosetta/executor.py +403 -0
- rosetta/flamegraph.py +630 -0
- rosetta/interactive.py +1790 -0
- rosetta/models.py +197 -0
- rosetta/parser.py +308 -0
- rosetta/reporter/__init__.py +1 -0
- rosetta/reporter/bench_html.py +1457 -0
- rosetta/reporter/bench_text.py +162 -0
- rosetta/reporter/history.py +1686 -0
- rosetta/reporter/html.py +644 -0
- rosetta/reporter/text.py +110 -0
- rosetta/runner.py +3089 -0
- rosetta/ui.py +736 -0
- rosetta/whitelist.py +161 -0
- rosetta_sql-1.0.0.dist-info/LICENSE +21 -0
- rosetta_sql-1.0.0.dist-info/METADATA +379 -0
- rosetta_sql-1.0.0.dist-info/RECORD +42 -0
- rosetta_sql-1.0.0.dist-info/WHEEL +5 -0
- rosetta_sql-1.0.0.dist-info/entry_points.txt +2 -0
- rosetta_sql-1.0.0.dist-info/top_level.txt +4 -0
- skills/rosetta/scripts/install_rosetta.py +469 -0
- skills/rosetta/scripts/rosetta_wrapper.py +377 -0
- tests/test_cli.py +749 -0
rosetta/reporter/text.py
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""Plain-text report generator for Rosetta."""
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
import time
|
|
5
|
+
from typing import Dict
|
|
6
|
+
|
|
7
|
+
from ..models import CompareResult
|
|
8
|
+
|
|
9
|
+
log = logging.getLogger("rosetta")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def write_text_report(path: str, test_file: str,
|
|
13
|
+
comparisons: Dict[str, CompareResult]) -> bool:
|
|
14
|
+
"""Write a plain-text comparison report.
|
|
15
|
+
|
|
16
|
+
Returns True if all comparisons passed.
|
|
17
|
+
"""
|
|
18
|
+
all_pass = True
|
|
19
|
+
|
|
20
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
21
|
+
f.write("=" * 70 + "\n")
|
|
22
|
+
f.write("Rosetta Cross-DBMS Test Comparison Report\n")
|
|
23
|
+
f.write(f"Test file: {test_file}\n")
|
|
24
|
+
f.write(f"Time: {time.strftime('%Y-%m-%d %H:%M:%S')}\n")
|
|
25
|
+
f.write("=" * 70 + "\n\n")
|
|
26
|
+
|
|
27
|
+
f.write("SUMMARY\n")
|
|
28
|
+
f.write("-" * 70 + "\n")
|
|
29
|
+
f.write(f"{'Comparison':<35} {'Match':>6} {'Mismatch':>9} "
|
|
30
|
+
f"{'Skip':>6} {'Total':>6} {'Pass%':>7}\n")
|
|
31
|
+
f.write("-" * 70 + "\n")
|
|
32
|
+
|
|
33
|
+
for key, cmp in comparisons.items():
|
|
34
|
+
f.write(f"{key:<35} {cmp.matched:>6} "
|
|
35
|
+
f"{cmp.mismatched:>9} {cmp.skipped:>6} "
|
|
36
|
+
f"{cmp.total_stmts:>6} "
|
|
37
|
+
f"{cmp.pass_rate:>6.1f}%\n")
|
|
38
|
+
if cmp.mismatched > 0:
|
|
39
|
+
all_pass = False
|
|
40
|
+
|
|
41
|
+
f.write("-" * 70 + "\n")
|
|
42
|
+
if all_pass:
|
|
43
|
+
f.write("RESULT: ALL PASSED\n\n")
|
|
44
|
+
else:
|
|
45
|
+
f.write("RESULT: DIFFERENCES FOUND\n\n")
|
|
46
|
+
|
|
47
|
+
for key, cmp in comparisons.items():
|
|
48
|
+
if not cmp.diffs:
|
|
49
|
+
continue
|
|
50
|
+
f.write("=" * 70 + "\n")
|
|
51
|
+
f.write(f"DIFFS: {key}\n")
|
|
52
|
+
f.write("=" * 70 + "\n")
|
|
53
|
+
for d in cmp.diffs:
|
|
54
|
+
f.write(f"\n--- Block {d['block']}: "
|
|
55
|
+
f"{d['stmt'][:80]}\n")
|
|
56
|
+
# Show surrounding context for quick orientation
|
|
57
|
+
ctx_before = d.get("context_before", [])
|
|
58
|
+
ctx_after = d.get("context_after", [])
|
|
59
|
+
if ctx_before or ctx_after:
|
|
60
|
+
f.write(" Context:\n")
|
|
61
|
+
for c in ctx_before:
|
|
62
|
+
f.write(f" Block {c['block']:>4}: "
|
|
63
|
+
f"{c['stmt'][:70]}\n")
|
|
64
|
+
f.write(f" ▶ Block {d['block']:>4}: "
|
|
65
|
+
f"{d['stmt'][:70]}\n")
|
|
66
|
+
for c in ctx_after:
|
|
67
|
+
f.write(f" Block {c['block']:>4}: "
|
|
68
|
+
f"{c['stmt'][:70]}\n")
|
|
69
|
+
for dl in d["diff"]:
|
|
70
|
+
f.write(dl + "\n")
|
|
71
|
+
f.write("\n")
|
|
72
|
+
|
|
73
|
+
log.info("Text report written: %s", path)
|
|
74
|
+
return all_pass
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def write_diff_file(path: str,
|
|
78
|
+
comparisons: Dict[str, CompareResult]):
|
|
79
|
+
"""Write a unified diff file."""
|
|
80
|
+
diff_lines = []
|
|
81
|
+
for key, cmp in comparisons.items():
|
|
82
|
+
if not cmp.diffs:
|
|
83
|
+
continue
|
|
84
|
+
diff_lines.append("=" * 70)
|
|
85
|
+
diff_lines.append(f"DIFFS: {key}")
|
|
86
|
+
diff_lines.append("=" * 70)
|
|
87
|
+
for d in cmp.diffs:
|
|
88
|
+
diff_lines.append(
|
|
89
|
+
f"\n--- Block {d['block']}: {d['stmt'][:100]}"
|
|
90
|
+
)
|
|
91
|
+
ctx_before = d.get("context_before", [])
|
|
92
|
+
ctx_after = d.get("context_after", [])
|
|
93
|
+
if ctx_before or ctx_after:
|
|
94
|
+
diff_lines.append(" Context:")
|
|
95
|
+
for c in ctx_before:
|
|
96
|
+
diff_lines.append(
|
|
97
|
+
f" Block {c['block']:>4}: {c['stmt'][:80]}")
|
|
98
|
+
diff_lines.append(
|
|
99
|
+
f" ▶ Block {d['block']:>4}: {d['stmt'][:80]}")
|
|
100
|
+
for c in ctx_after:
|
|
101
|
+
diff_lines.append(
|
|
102
|
+
f" Block {c['block']:>4}: {c['stmt'][:80]}")
|
|
103
|
+
for dl in d["diff"]:
|
|
104
|
+
diff_lines.append(dl)
|
|
105
|
+
diff_lines.append("")
|
|
106
|
+
|
|
107
|
+
if diff_lines:
|
|
108
|
+
with open(path, "w", encoding="utf-8") as f:
|
|
109
|
+
f.write("\n".join(diff_lines) + "\n")
|
|
110
|
+
log.info("Diff file written: %s", path)
|