File: test_config_compare.py

package info (click to toggle)
duckdb 1.5.1-2
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 299,196 kB
  • sloc: cpp: 865,414; ansic: 57,292; python: 18,871; sql: 12,663; lisp: 11,751; yacc: 7,412; lex: 1,682; sh: 747; makefile: 558
file content (53 lines) | stat: -rw-r--r-- 1,317 bytes parent folder | download | duplicates (3)
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
import json
from collections import defaultdict
import sys


def load_skip_dict(path):
    """Load a skip_tests list into a dict: reason -> set(paths)."""
    with open(path) as f:
        data = json.load(f)

    out = {}
    for block in data.get("skip_tests", []):
        reason = block["reason"]
        paths = set(block.get("paths", []))
        out[reason] = paths
    return out


def compare_files(file_a, file_b):
    a = load_skip_dict(file_a)
    b = load_skip_dict(file_b)

    all_reasons = set(a.keys()) | set(b.keys())

    for reason in sorted(all_reasons):
        paths_a = a.get(reason, set())
        paths_b = b.get(reason, set())

        added = sorted(paths_b - paths_a)
        removed = sorted(paths_a - paths_b)

        if not added and not removed:
            continue

        print(f"\n=== Reason: {reason} ===")

        if removed:
            print("  - Present in A but NOT in B:")
            for p in removed:
                print(f"      {p}")

        if added:
            print("  + Present in B but NOT in A:")
            for p in added:
                print(f"      {p}")


if __name__ == "__main__":
    if len(sys.argv) != 3:
        print("Usage: python compare_skip_tests.py <fileA.json> <fileB.json>")
        exit(1)

    compare_files(sys.argv[1], sys.argv[2])