htmlcmp 2.4.0__tar.gz → 2.4.1__tar.gz
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.
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/PKG-INFO +1 -1
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/pyproject.toml +1 -1
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/compare_output_cli.py +9 -16
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/PKG-INFO +1 -1
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/SOURCES.txt +1 -0
- htmlcmp-2.4.1/tests/test_collect_tasks.py +30 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/README.md +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/setup.cfg +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/__init__.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/common.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/compare_output_server.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/html_render_diff.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/static/common.js +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/static/compare.js +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/static/index.js +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/static/style.css +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/templates/compare.html +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/templates/index.html +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/templates/missing.html +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp/tidy_output.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/dependency_links.txt +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/entry_points.txt +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/requires.txt +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/src/htmlcmp.egg-info/top_level.txt +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/tests/test_compare_html_retries.py +0 -0
- {htmlcmp-2.4.0 → htmlcmp-2.4.1}/tests/test_html_render_diff.py +0 -0
|
@@ -57,21 +57,19 @@ class Failure:
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
def collect_tasks(
|
|
60
|
-
a: Path, b: Path,
|
|
60
|
+
a: Path, b: Path, rel: Path = Path(), diff_output: Path = None, retries: int = 1
|
|
61
61
|
) -> tuple[list[Task], list[Failure]]:
|
|
62
62
|
"""Walk both trees once and return (comparable tasks, structural failures).
|
|
63
63
|
|
|
64
64
|
Structural failures are files/directories present on only one side; they are
|
|
65
|
-
known to differ up-front and never get submitted to the executor.
|
|
65
|
+
known to differ up-front and never get submitted to the executor. `rel` is
|
|
66
|
+
the path of `a` and `b` below the roots of the walk.
|
|
66
67
|
"""
|
|
67
68
|
if not isinstance(a, Path) or not isinstance(b, Path):
|
|
68
69
|
raise TypeError("Both arguments must be of type Path")
|
|
69
70
|
if not a.is_dir() or not b.is_dir():
|
|
70
71
|
raise FileNotFoundError("Both arguments must be directories")
|
|
71
72
|
|
|
72
|
-
if root is None:
|
|
73
|
-
root = a
|
|
74
|
-
|
|
75
73
|
tasks: list[Task] = []
|
|
76
74
|
failures: list[Failure] = []
|
|
77
75
|
|
|
@@ -86,11 +84,10 @@ def collect_tasks(
|
|
|
86
84
|
}
|
|
87
85
|
|
|
88
86
|
for name in sorted(left_files | right_files):
|
|
89
|
-
rel = (a / name).relative_to(root)
|
|
90
87
|
if name in left_files and name in right_files:
|
|
91
88
|
tasks.append(
|
|
92
89
|
Task(
|
|
93
|
-
rel,
|
|
90
|
+
rel / name,
|
|
94
91
|
a / name,
|
|
95
92
|
b / name,
|
|
96
93
|
None if diff_output is None else diff_output / name,
|
|
@@ -98,9 +95,9 @@ def collect_tasks(
|
|
|
98
95
|
)
|
|
99
96
|
)
|
|
100
97
|
elif name in left_files:
|
|
101
|
-
failures.append(Failure(rel, "missing", "missing in monitored (B)"))
|
|
98
|
+
failures.append(Failure(rel / name, "missing", "missing in monitored (B)"))
|
|
102
99
|
else:
|
|
103
|
-
failures.append(Failure(rel, "missing", "missing in reference (A)"))
|
|
100
|
+
failures.append(Failure(rel / name, "missing", "missing in reference (A)"))
|
|
104
101
|
|
|
105
102
|
left_dirs = {name for name in left if (a / name).is_dir()}
|
|
106
103
|
right_dirs = {name for name in right if (b / name).is_dir()}
|
|
@@ -109,7 +106,7 @@ def collect_tasks(
|
|
|
109
106
|
sub_tasks, sub_failures = collect_tasks(
|
|
110
107
|
a / name,
|
|
111
108
|
b / name,
|
|
112
|
-
|
|
109
|
+
rel=rel / name,
|
|
113
110
|
diff_output=None if diff_output is None else diff_output / name,
|
|
114
111
|
retries=retries,
|
|
115
112
|
)
|
|
@@ -117,13 +114,9 @@ def collect_tasks(
|
|
|
117
114
|
failures.extend(sub_failures)
|
|
118
115
|
|
|
119
116
|
for name in sorted(left_dirs - right_dirs):
|
|
120
|
-
failures.append(
|
|
121
|
-
Failure((a / name).relative_to(root), "missing", "missing in monitored (B)")
|
|
122
|
-
)
|
|
117
|
+
failures.append(Failure(rel / name, "missing", "missing in monitored (B)"))
|
|
123
118
|
for name in sorted(right_dirs - left_dirs):
|
|
124
|
-
failures.append(
|
|
125
|
-
Failure((b / name).relative_to(root), "missing", "missing in reference (A)")
|
|
126
|
-
)
|
|
119
|
+
failures.append(Failure(rel / name, "missing", "missing in reference (A)"))
|
|
127
120
|
|
|
128
121
|
return tasks, failures
|
|
129
122
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""A file or directory on one side only is a failure, named below the roots."""
|
|
2
|
+
|
|
3
|
+
from pathlib import Path
|
|
4
|
+
|
|
5
|
+
from htmlcmp.compare_output_cli import collect_tasks
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def write(path: Path):
|
|
9
|
+
path.parent.mkdir(parents=True, exist_ok=True)
|
|
10
|
+
path.write_text("<html></html>")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_one_sided_entries_are_named_below_the_roots(tmp_path):
|
|
14
|
+
a, b = tmp_path / "a", tmp_path / "b"
|
|
15
|
+
write(a / "both" / "page.html")
|
|
16
|
+
write(b / "both" / "page.html")
|
|
17
|
+
write(a / "both" / "only_a.html")
|
|
18
|
+
write(b / "both" / "only_b.html")
|
|
19
|
+
write(a / "dir_a" / "page.html")
|
|
20
|
+
write(b / "dir_b" / "page.html")
|
|
21
|
+
|
|
22
|
+
tasks, failures = collect_tasks(a, b)
|
|
23
|
+
|
|
24
|
+
assert [task.rel for task in tasks] == [Path("both/page.html")]
|
|
25
|
+
assert sorted((str(f.rel), f.reason) for f in failures) == [
|
|
26
|
+
("both/only_a.html", "missing in monitored (B)"),
|
|
27
|
+
("both/only_b.html", "missing in reference (A)"),
|
|
28
|
+
("dir_a", "missing in monitored (B)"),
|
|
29
|
+
("dir_b", "missing in reference (A)"),
|
|
30
|
+
]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|