diffcone 0.4.0__tar.gz → 0.6.0__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.
- {diffcone-0.4.0 → diffcone-0.6.0}/PKG-INFO +1 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/pyproject.toml +2 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/pyproject.toml.orig +2 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/cache.py +117 -7
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/check.py +32 -2
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/child.py +7 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/ci_report.py +208 -12
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/classify.py +28 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/cli.py +151 -15
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/collect.py +208 -17
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/declarations.py +6 -16
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/discovery/asv_static.py +17 -2
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/discovery/common.py +41 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/discovery/pytest_static.py +1601 -99
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/evidence.py +148 -9
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/evidence_plan.py +944 -211
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/execution.py +335 -38
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/__init__.py +67 -8
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/aliases.py +127 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/core.py +1034 -32
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/definitions.py +3 -0
- diffcone-0.6.0/src/diffcone/indexer/facts.py +908 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/lazy.py +199 -3
- diffcone-0.6.0/src/diffcone/indexer/literals.py +1200 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/process.py +10 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/references.py +2261 -27
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/resolver.py +282 -23
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/scopes.py +54 -2
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/scripts.py +144 -24
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/state.py +18 -1
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/symbols.py +37 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/syntax.py +4 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/uses.py +399 -20
- diffcone-0.6.0/src/diffcone/indexer/writes.py +3486 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/model.py +157 -26
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/planner.py +487 -60
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/report.py +41 -6
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/selection.py +5 -3
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/snapshot.py +130 -5
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/testing.py +30 -17
- diffcone-0.4.0/src/diffcone/indexer/facts.py +0 -525
- diffcone-0.4.0/src/diffcone/indexer/literals.py +0 -559
- diffcone-0.4.0/src/diffcone/indexer/writes.py +0 -1061
- {diffcone-0.4.0 → diffcone-0.6.0}/LICENSE +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/README.md +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/__init__.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/cython.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/discovery/__init__.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/discovery/session_state.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/dynamics.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/indexer/patches.py +0 -0
- {diffcone-0.4.0 → diffcone-0.6.0}/src/diffcone/manifest.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: diffcone
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.6.0
|
|
4
4
|
Summary: Static-first, function-level change-impact engine for Python: which tests and benchmarks a change can affect, and why
|
|
5
5
|
Keywords: test selection,test impact analysis,change impact,pytest,asv,ci
|
|
6
6
|
Author: Bearing Research
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "diffcone"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Static-first, function-level change-impact engine for Python: which tests and benchmarks a change can affect, and why"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -53,6 +53,7 @@ dev = [
|
|
|
53
53
|
"cython>=3.1",
|
|
54
54
|
"pytest>=8",
|
|
55
55
|
"pytest-cov>=5",
|
|
56
|
+
"pytest-xdist>=3.6",
|
|
56
57
|
"ruff>=0.5",
|
|
57
58
|
"setuptools",
|
|
58
59
|
"ty==0.0.84",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "diffcone"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.6.0"
|
|
4
4
|
description = "Static-first, function-level change-impact engine for Python: which tests and benchmarks a change can affect, and why"
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "MIT"
|
|
@@ -44,6 +44,7 @@ dev = [
|
|
|
44
44
|
"cython>=3.1", # tests that build a profiled extension (evidence over Cython)
|
|
45
45
|
"pytest>=8",
|
|
46
46
|
"pytest-cov>=5",
|
|
47
|
+
"pytest-xdist>=3.6",
|
|
47
48
|
"ruff>=0.5",
|
|
48
49
|
"setuptools", # builds those extensions
|
|
49
50
|
"ty==0.0.84", # pre-1.0: pinned, since new releases add checks
|
|
@@ -53,6 +53,64 @@ from diffcone.model import (
|
|
|
53
53
|
)
|
|
54
54
|
|
|
55
55
|
# Bump whenever the indexer's output for the same input can change.
|
|
56
|
+
# 62: a class reached by another name is written through it, one record of
|
|
57
|
+
# what each class is given (writes.ClassRecord), shared objects bound in
|
|
58
|
+
# methods, nested classes' state, library methods on a class and
|
|
59
|
+
# ``type()`` of three arguments (audit round 7, U2, U3, U11, U12);
|
|
60
|
+
# 63: SourceIndex.decorator_symbols goes through the whole-index cache
|
|
61
|
+
# (audit round 7, U27); the state rules of round 7's state batch;
|
|
62
|
+
# 64: typed_calls and shared_instances; receiver attribute stores keep
|
|
63
|
+
# their name (``@self.x``), re-initialisation is ``@init``; memoisers
|
|
64
|
+
# applied by a call (audit round 7, U4, U5, U14, U15, U16, U17, U18);
|
|
65
|
+
# 65: open classes include those with an ``abc.ABC``, ``Protocol``,
|
|
66
|
+
# ``NamedTuple`` or ``TypedDict`` base (audit round 8, V4);
|
|
67
|
+
# 66: what an install in sys.modules installs (``>`` sources, ``installs``
|
|
68
|
+
# edges, SourceIndex.installed_names), readers of a name outside the
|
|
69
|
+
# roots depend on the installing code (audit round 8, V10, V11);
|
|
70
|
+
# 67: the logging library's callbacks and records, writes through ``*args``/
|
|
71
|
+
# ``**kwargs`` and starred arguments and through what a fresh object
|
|
72
|
+
# holds, module-level ``locals()`` (audit round 8, V1, V4, V7, V8, V9);
|
|
73
|
+
# 68: open classes include those whose body hands ``locals()``/``vars()`` on
|
|
74
|
+
# (audit round 8, V4, evidence);
|
|
75
|
+
# 69: a call's result written writes what the callee may return of what it was
|
|
76
|
+
# handed (``result_calls``, ``param_returns``), elements of a parameter
|
|
77
|
+
# handed on, a function stored as a logging callback called by name
|
|
78
|
+
# (audit round 8, V7, V19, V20);
|
|
79
|
+
# 70: the variables logging callbacks write depend on the log sites through
|
|
80
|
+
# one pseudo-node per set of callbacks (model.LOG_CALLBACKS);
|
|
81
|
+
# 71: SourceIndex.open_installs (the code installing, under a name outside
|
|
82
|
+
# the roots, what no module of the analysis names; discovery's plugins);
|
|
83
|
+
# 72: SourceIndex.definition_writes and definition_calls (what only a
|
|
84
|
+
# function's decorators, defaults and annotations write or call; audit
|
|
85
|
+
# round 8, V28);
|
|
86
|
+
# 73: a library module reached through a project module's import binding is
|
|
87
|
+
# read for what follows it, and the receiver of a call naming its
|
|
88
|
+
# attributes literally (``monkeypatch.setattr(m.sys, "x", v)``) for those
|
|
89
|
+
# attributes only (audit round 8, V30);
|
|
90
|
+
# 59: a class attribute bound once to a value that cannot change in place
|
|
91
|
+
# is no root of its class (audit round 6, T24); an instance holds the
|
|
92
|
+
# arguments its constructor was handed, and only a write that may reach
|
|
93
|
+
# them writes them (T23);
|
|
94
|
+
# 58: an instance an in-scope class makes (``Store()``, ``cls.__new__(cls)``)
|
|
95
|
+
# is no root of the class; a write in place into it writes the class
|
|
96
|
+
# when the class holds state, and ``__new__``/``__init_subclass__`` take
|
|
97
|
+
# the class (audit round 6, T22);
|
|
98
|
+
# 57: a write in place into a module variable holding an instance of an
|
|
99
|
+
# in-scope class with class-level state writes the class and its
|
|
100
|
+
# in-scope bases too (audit round 6, T21);
|
|
101
|
+
# 56: SourceIndex.stores without what the value derives from, through
|
|
102
|
+
# ``__dict__``/``vars()`` and explicit re-initialisation (audit T19);
|
|
103
|
+
# 55: no mutated_by edge from a module variable whose one binding is an
|
|
104
|
+
# immutable value nothing binds anew (audit round 6, T20);
|
|
105
|
+
# 54: writes to state held on a class, and through another name for a module
|
|
106
|
+
# variable (a local alias, a getter's result, globals()), give mutated_by
|
|
107
|
+
# edges (audit round 6, T6 and T7);
|
|
108
|
+
# 53: imports and runs of files [index] exclude keeps out are unknown
|
|
109
|
+
# dependencies; pytest.importorskip, find_spec, pkgutil imports (T2, T9);
|
|
110
|
+
# 52: SourceIndex.write_values, call_values removed again (audit T1);
|
|
111
|
+
# 51: SourceIndex.write_values, call_values (what in-place writes store and calls
|
|
112
|
+
# hand on; E32, E35, E36);
|
|
113
|
+
# 50: SnapshotInfo.excluded (diffcone.toml [index] exclude; E29);
|
|
56
114
|
# 49: SourceIndex.lazy_constants (indexer/lazy.py; roadmap item 19, rule 2);
|
|
57
115
|
# 48: Symbol.annotation_names (what a function's annotations can read; E7);
|
|
58
116
|
# 47: a name bound to modules reads off them (indexer/aliases.py), and a
|
|
@@ -87,7 +145,7 @@ from diffcone.model import (
|
|
|
87
145
|
# and modules (indexer.uses); 28: __subclasses__ reads; 27: type
|
|
88
146
|
# parameters, unnameable build scripts as other files; 26: escaped values;
|
|
89
147
|
# 25: external sites; 24: docstring decorators; 23: open classes
|
|
90
|
-
INDEX_FORMAT =
|
|
148
|
+
INDEX_FORMAT = 73
|
|
91
149
|
|
|
92
150
|
|
|
93
151
|
def _indexer_fingerprint() -> str:
|
|
@@ -165,6 +223,8 @@ def index_to_dict(index: SourceIndex) -> dict:
|
|
|
165
223
|
"attribute_modules": sorted(index.attribute_modules),
|
|
166
224
|
"any_module_readers": sorted(index.any_module_readers),
|
|
167
225
|
"module_writers": {m: list(w) for m, w in sorted(index.module_writers.items())},
|
|
226
|
+
"installed_names": {n: list(v) for n, v in sorted(index.installed_names.items())},
|
|
227
|
+
"open_installs": {n: [list(w) for w in v] for n, v in sorted(index.open_installs.items())},
|
|
168
228
|
"other_files": dict(sorted(index.other_files.items())),
|
|
169
229
|
"file_modes": dict(sorted(index.file_modes.items())),
|
|
170
230
|
"symbols": [asdict(s) for _, s in sorted(index.symbols.items())],
|
|
@@ -183,6 +243,7 @@ def index_to_dict(index: SourceIndex) -> dict:
|
|
|
183
243
|
"class_bases": {c: list(b) for c, b in sorted(index.class_bases.items())},
|
|
184
244
|
"open_classes": sorted(index.open_classes),
|
|
185
245
|
"doc_decorated": sorted(index.doc_decorated),
|
|
246
|
+
"decorator_symbols": sorted(index.decorator_symbols),
|
|
186
247
|
"scripts": dict(sorted(index.scripts.items())),
|
|
187
248
|
"script_refs": sorted(list(r) for r in index.script_refs),
|
|
188
249
|
"process_writes": sorted(list(w) for w in index.process_writes),
|
|
@@ -191,7 +252,11 @@ def index_to_dict(index: SourceIndex) -> dict:
|
|
|
191
252
|
"handed": sorted(list(h) for h in index.handed),
|
|
192
253
|
"memoized": sorted(index.memoized),
|
|
193
254
|
"decorations": sorted(list(d) for d in index.decorations),
|
|
255
|
+
"typed_calls": sorted(list(t) for t in index.typed_calls),
|
|
256
|
+
"shared_instances": sorted(index.shared_instances),
|
|
194
257
|
"lazy_constants": dict(sorted(index.lazy_constants.items())),
|
|
258
|
+
"definition_writes": sorted(list(w) for w in index.definition_writes),
|
|
259
|
+
"definition_calls": sorted(list(c) for c in index.definition_calls),
|
|
195
260
|
"cython": {
|
|
196
261
|
path: {
|
|
197
262
|
"functions": [{**asdict(f), "names": sorted(f.names)} for f in module.functions],
|
|
@@ -211,7 +276,11 @@ def index_from_dict(data: dict) -> SourceIndex:
|
|
|
211
276
|
symbols = {s.id: s for s in map(symbol_from_dict, data["symbols"])}
|
|
212
277
|
return SourceIndex(
|
|
213
278
|
snapshot=SnapshotInfo(
|
|
214
|
-
**data["snapshot"]
|
|
279
|
+
**data["snapshot"]
|
|
280
|
+
| {
|
|
281
|
+
"kind": SnapshotKind(data["snapshot"]["kind"]),
|
|
282
|
+
"excluded": tuple(data["snapshot"]["excluded"]),
|
|
283
|
+
}
|
|
215
284
|
),
|
|
216
285
|
modules=set(data["modules"]),
|
|
217
286
|
symbols=symbols,
|
|
@@ -231,6 +300,8 @@ def index_from_dict(data: dict) -> SourceIndex:
|
|
|
231
300
|
attribute_modules=set(data["attribute_modules"]),
|
|
232
301
|
any_module_readers=set(data["any_module_readers"]),
|
|
233
302
|
module_writers={m: tuple(w) for m, w in data["module_writers"].items()},
|
|
303
|
+
installed_names={n: tuple(v) for n, v in data["installed_names"].items()},
|
|
304
|
+
open_installs={n: tuple((w, a) for w, a in v) for n, v in data["open_installs"].items()},
|
|
234
305
|
other_files=dict(data["other_files"]),
|
|
235
306
|
file_modes=dict(data["file_modes"]),
|
|
236
307
|
reflection={(s, d) for s, d in data["reflection"]},
|
|
@@ -240,15 +311,20 @@ def index_from_dict(data: dict) -> SourceIndex:
|
|
|
240
311
|
class_bases={c: tuple(b) for c, b in data["class_bases"].items()},
|
|
241
312
|
open_classes=set(data["open_classes"]),
|
|
242
313
|
doc_decorated=set(data["doc_decorated"]),
|
|
314
|
+
decorator_symbols=set(data["decorator_symbols"]),
|
|
243
315
|
scripts=dict(data["scripts"]),
|
|
244
316
|
script_refs={(s, p) for s, p in data["script_refs"]},
|
|
245
317
|
process_writes={(s, w) for s, w in data["process_writes"]},
|
|
246
318
|
main_guarded={(a, b, c) for a, b, c in data["main_guarded"]},
|
|
247
|
-
stores={(a, b
|
|
319
|
+
stores={(a, b) for a, b in data["stores"]},
|
|
248
320
|
handed={(a, b, c) for a, b, c in data["handed"]},
|
|
249
321
|
memoized=set(data["memoized"]),
|
|
250
322
|
decorations={(a, b) for a, b in data["decorations"]},
|
|
323
|
+
typed_calls={(a, b) for a, b in data["typed_calls"]},
|
|
324
|
+
shared_instances=set(data["shared_instances"]),
|
|
251
325
|
lazy_constants=dict(data["lazy_constants"]),
|
|
326
|
+
definition_writes={(a, b) for a, b in data["definition_writes"]},
|
|
327
|
+
definition_calls={(a, b) for a, b in data["definition_calls"]},
|
|
252
328
|
cython={
|
|
253
329
|
path: CythonModule(
|
|
254
330
|
path,
|
|
@@ -298,7 +374,10 @@ class ModuleCache:
|
|
|
298
374
|
the file read-only and work on a directory that cannot be written."""
|
|
299
375
|
|
|
300
376
|
def __init__(self, directory: Path) -> None:
|
|
301
|
-
|
|
377
|
+
# Absolute, so that the read-only URI below can be formed: a relative
|
|
378
|
+
# directory (the default ``--repo .``) once made every read a miss
|
|
379
|
+
# (audit round 7, U24).
|
|
380
|
+
self.path = (directory / "modules.sqlite").absolute()
|
|
302
381
|
# Hit and miss counters: test instrumentation, nothing reads them else.
|
|
303
382
|
self.facts_hits = 0
|
|
304
383
|
self.facts_misses = 0
|
|
@@ -405,7 +484,8 @@ class ModuleCache:
|
|
|
405
484
|
conn.close()
|
|
406
485
|
|
|
407
486
|
|
|
408
|
-
|
|
487
|
+
# 2: lifecycle dependencies every target lists are written once (audit E37)
|
|
488
|
+
DISCOVERY_FORMAT = 2
|
|
409
489
|
|
|
410
490
|
|
|
411
491
|
def _discovery_fingerprint() -> str:
|
|
@@ -422,6 +502,27 @@ def _discovery_fingerprint() -> str:
|
|
|
422
502
|
DISCOVERY_FINGERPRINT = _discovery_fingerprint()
|
|
423
503
|
|
|
424
504
|
|
|
505
|
+
def _sorted_unique(deps: tuple[str, ...]) -> bool:
|
|
506
|
+
return all(a < b for a, b in zip(deps, deps[1:], strict=False))
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
def _shared_lifecycle(targets: list[Target]) -> frozenset[str]:
|
|
510
|
+
"""The lifecycle dependencies every target lists, where each lists them
|
|
511
|
+
sorted and once (as discovery does), so a target's own rest rebuilds it."""
|
|
512
|
+
sets = [frozenset(t.lifecycle_dependencies) for t in targets]
|
|
513
|
+
if not sets or not all(_sorted_unique(t.lifecycle_dependencies) for t in targets):
|
|
514
|
+
return frozenset()
|
|
515
|
+
return frozenset.intersection(*sets)
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
def _target_entry(target: Target, shared: frozenset[str]) -> dict[str, Any]:
|
|
519
|
+
entry = asdict(target)
|
|
520
|
+
if shared:
|
|
521
|
+
del entry["lifecycle_dependencies"]
|
|
522
|
+
entry["own"] = [d for d in target.lifecycle_dependencies if d not in shared]
|
|
523
|
+
return entry
|
|
524
|
+
|
|
525
|
+
|
|
425
526
|
class DiscoveryCache:
|
|
426
527
|
"""Static discovery results per committed snapshot. Discovery reads only
|
|
427
528
|
the snapshot and its index, so a commit, source roots, runner and
|
|
@@ -449,6 +550,8 @@ class DiscoveryCache:
|
|
|
449
550
|
data = json.loads(self._path(commit, roots, runner, options).read_text("utf-8"))
|
|
450
551
|
if data.get("format") != DISCOVERY_FORMAT or data.get("commit") != commit:
|
|
451
552
|
return None
|
|
553
|
+
shared = data["shared"]
|
|
554
|
+
pool: dict[str, str] = {d: d for d in shared}
|
|
452
555
|
return DiscoveryResult(
|
|
453
556
|
runner=data["runner"],
|
|
454
557
|
targets=[
|
|
@@ -456,7 +559,9 @@ class DiscoveryCache:
|
|
|
456
559
|
t["runner"],
|
|
457
560
|
t["runner_id"],
|
|
458
561
|
t["entry_symbol"],
|
|
459
|
-
tuple(t["
|
|
562
|
+
tuple(sorted([*shared, *(pool.setdefault(d, d) for d in t["own"])]))
|
|
563
|
+
if "own" in t
|
|
564
|
+
else tuple(t["lifecycle_dependencies"]),
|
|
460
565
|
)
|
|
461
566
|
for t in data["targets"]
|
|
462
567
|
],
|
|
@@ -476,12 +581,17 @@ class DiscoveryCache:
|
|
|
476
581
|
if any(TOO_DEEP in n.detail for n in result.notes):
|
|
477
582
|
return # depends on the caller's stack depth, not only on the commit
|
|
478
583
|
path = self._path(commit, roots, result.runner, options)
|
|
584
|
+
shared = _shared_lifecycle(result.targets)
|
|
479
585
|
data = {
|
|
480
586
|
"format": DISCOVERY_FORMAT,
|
|
481
587
|
"commit": commit,
|
|
482
588
|
"fingerprint": DISCOVERY_FINGERPRINT,
|
|
483
589
|
"runner": result.runner,
|
|
484
|
-
|
|
590
|
+
# What every target depends on, written once (audit E37: pandas'
|
|
591
|
+
# 25 620 targets each carry the same 654, a 680 MB file that took
|
|
592
|
+
# 1.4 GB to load); a target lists the rest (``own``).
|
|
593
|
+
"shared": sorted(shared),
|
|
594
|
+
"targets": [_target_entry(t, shared) for t in result.targets],
|
|
485
595
|
"notes": [asdict(n) for n in result.notes],
|
|
486
596
|
"config": result.config,
|
|
487
597
|
}
|
|
@@ -255,6 +255,24 @@ class CheckReport:
|
|
|
255
255
|
def ok(self) -> bool:
|
|
256
256
|
return not self.misses and not self.not_run
|
|
257
257
|
|
|
258
|
+
@property
|
|
259
|
+
def own_run_checked(self) -> bool:
|
|
260
|
+
"""Whether diffcone's own run was given (``--run diffcone=...``):
|
|
261
|
+
without it the check says the plan selected every new failure, not
|
|
262
|
+
that the selected tests ran."""
|
|
263
|
+
return any(r.name == OWN_RUN for r in self.runs)
|
|
264
|
+
|
|
265
|
+
@property
|
|
266
|
+
def verdict(self) -> str:
|
|
267
|
+
if not self.ok:
|
|
268
|
+
return "MISS"
|
|
269
|
+
if self.own_run_checked:
|
|
270
|
+
return "OK: every new failure was selected and run"
|
|
271
|
+
return (
|
|
272
|
+
"OK: every new failure was selected; whether diffcone's run ran them was not "
|
|
273
|
+
f"checked (no --run {OWN_RUN}=JUNIT)"
|
|
274
|
+
)
|
|
275
|
+
|
|
258
276
|
|
|
259
277
|
def _broken(cases: list[Case], targets: _Targets) -> dict[str, tuple[str, str, set[str]]]:
|
|
260
278
|
"""Test -> (outcome, kind, broken case keys) for every broken case, by
|
|
@@ -391,6 +409,7 @@ def to_dict(report: CheckReport) -> dict:
|
|
|
391
409
|
return {
|
|
392
410
|
"ok": report.ok,
|
|
393
411
|
"not_run": report.not_run,
|
|
412
|
+
"own_run_checked": report.own_run_checked,
|
|
394
413
|
"plan": {
|
|
395
414
|
"status": report.plan_status,
|
|
396
415
|
"discovery_incomplete": report.discovery_incomplete,
|
|
@@ -469,14 +488,19 @@ def to_text(report: CheckReport) -> str:
|
|
|
469
488
|
lines.append(
|
|
470
489
|
f"diffcone's run did not run {len(report.not_run)} new failure(s) (see NOT RUN above)"
|
|
471
490
|
)
|
|
472
|
-
lines.append(
|
|
491
|
+
lines.append(report.verdict)
|
|
473
492
|
return "\n".join(lines) + "\n"
|
|
474
493
|
|
|
475
494
|
|
|
476
495
|
def to_markdown(report: CheckReport) -> str:
|
|
477
496
|
new = [f for f in report.failures if not f.already]
|
|
478
497
|
missed = len({f.test for f in report.misses} | set(report.not_run))
|
|
479
|
-
|
|
498
|
+
if not report.ok:
|
|
499
|
+
verdict = f"**{missed} missed**"
|
|
500
|
+
elif report.own_run_checked:
|
|
501
|
+
verdict = "no miss"
|
|
502
|
+
else:
|
|
503
|
+
verdict = "no miss in the plan (diffcone's run not checked)"
|
|
480
504
|
lines = [
|
|
481
505
|
f"### diffcone check: {verdict}",
|
|
482
506
|
"",
|
|
@@ -504,6 +528,12 @@ def to_markdown(report: CheckReport) -> str:
|
|
|
504
528
|
)
|
|
505
529
|
if report.mapping_doubtful:
|
|
506
530
|
lines += ["", report.mapping_note + "."]
|
|
531
|
+
if not report.own_run_checked:
|
|
532
|
+
lines += [
|
|
533
|
+
"",
|
|
534
|
+
"Only the plan was checked: without the JUnit XML of diffcone's own run "
|
|
535
|
+
f"(`--run {OWN_RUN}=...`), whether the selected tests ran is not known.",
|
|
536
|
+
]
|
|
507
537
|
if report.misses:
|
|
508
538
|
lines += ["", "Missed by the plan:", ""]
|
|
509
539
|
lines += [f"- `{f.test}` ({f.outcome}, {f.kind})" for f in report.misses]
|
|
@@ -525,6 +525,13 @@ LISTING_EVENTS = frozenset({"os.listdir", "os.scandir"})
|
|
|
525
525
|
# edit to any direct entry may have been read. The fold and the planner
|
|
526
526
|
# read the suffix (evidence_plan._file).
|
|
527
527
|
SCANNED = "/*"
|
|
528
|
+
# A file whose lines ``linecache`` read inside a test (a traceback or a
|
|
529
|
+
# warning formatted, ``inspect.getsource``) is recorded with this suffix
|
|
530
|
+
# instead: the test touched it, but what it read are lines to show, which
|
|
531
|
+
# planning does not follow into project state (evidence_plan's
|
|
532
|
+
# ``_file_readers`` seeds nothing from it; audit round 7, U6). A file has
|
|
533
|
+
# no entries, so the suffix names no real path.
|
|
534
|
+
SHOWN = "/:lines"
|
|
528
535
|
# Events after which a path may resolve through other links: the memo of
|
|
529
536
|
# real paths is dropped.
|
|
530
537
|
LINK_EVENTS = frozenset({"os.symlink", "os.rename", "os.remove", "os.rmdir", "os.link"})
|